ComfyUI Extension: comfyui-node-template
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.
A simple ComfyUI node development starter template.
README
comfyui-node-template
A simple ComfyUI node development starter template.
Custom Node Class
Start by defining a node class.
class MyComfyNode:
__init__(self):
pass
Input Map
Required Inputs
@classmethod
def INPUT_TYPES(cls):
return {"required": {
# required entry components go here,
}}
Optional Inputs
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
# required entry components go here,
},
"optional": {
# optional entries go here,
}
}
No Inputs
@classmethod
def INPUT_TYPES(cls):
return {}
Entry Components
STRING
Creates a string type entry.
"strval": ("STRING", {"default": "a string", "tooltip": "a string entry"})
FLOAT
Creates a float slider entry.
"floatval": ("FLOAT", {"default": 20.0, "min" 0.5, "max": 150.0, "step": 0.5, "tooltip": "a float"})
INT
Create a integer slider entry.
"intval": ("INT", {"default": 2, "min": 1, "max": 10, "tootip": "an integer"})
BOOLEAN
Create a boolean switch entry.
"boolval": ("BOOLEAN", {"default": False, "tooltip": "a boolean toggle"})
CLIP
Clip Input
"clip": ("CLIP", {"clip_name": "clip_name", "type":"stable_diffusion"})
MODEL
Model Input
VAE
VAE Input
CONDITIONING
Conditioning Input
IMAGE
Image Input
MASK
Mask Input
LATENT
Latent Input
CLIP_VISION
Clip Vision Input
CLIP_VISION_OUTPUT
Clip Vision Output
Drop Down Menu
"dropdown": (["opt_1", "opt_2", "opt_3"], "default": "opt_2")
Class Methods
@classmethod
def INPUT_TYPES(cls):
res = s.do_something(cls)
@classmethod
def do_something(cls):
#do work
return res
Output (RETURN) Map
Uses the same constants as inputs.
RETURN_TYPES = ("STRING", "STRING", "FLOAT",) #output type
RETURN_NAMES = ("model", "vae", "amount",) # display name
Activation Function
FUNCTION = "execute"
def execute(self):
pass #do work
Metadata
CATEGORY = "<category>/MyComfyNode"
DESCRIPTION = "My handy ComfyUI node"
Node Mappings
NODE_CLASS_MAPPINGS = {
"MyComfyNode": MyComfyNode,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"MyComfyNode": "My ComfyUI Node"
}
Node placement
The custom node directory goes in comfyui/custom_nodes/<my-comfy-node>
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.