From 880da2a41834489f5feae88b1a3c3723887de295 Mon Sep 17 00:00:00 2001 From: BennyKok Date: Sun, 17 Dec 2023 22:03:23 +0800 Subject: [PATCH] feat: add external text input node --- comfy-nodes/external_text.py | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 comfy-nodes/external_text.py diff --git a/comfy-nodes/external_text.py b/comfy-nodes/external_text.py new file mode 100644 index 0000000..83d6419 --- /dev/null +++ b/comfy-nodes/external_text.py @@ -0,0 +1,38 @@ +import folder_paths +from PIL import Image, ImageOps +import numpy as np +import torch + +class ComfyUIDeployExternalText: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "input_id": ( + "STRING", + {"multiline": False, "default": "input_text"}, + ), + }, + "optional": { + "default_text": ( + "STRING", + {"multiline": True, "default": ""}, + ), + } + } + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("text",) + + FUNCTION = "run" + + CATEGORY = "text" + + def run(self, input_id, default_text=None): + if not input_id or len(input_id.strip()) == 0: + return [default_text] + return [input_id] + + +NODE_CLASS_MAPPINGS = {"ComfyUIDeployExternalText": ComfyUIDeployExternalText} +NODE_DISPLAY_NAME_MAPPINGS = {"ComfyUIDeployExternalText": "External Text (ComfyUI Deploy)"} \ No newline at end of file