Skip to content

Commit

Permalink
add Sampler_names
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowcz007 committed Jan 23, 2024
1 parent 10face6 commit a6cd383
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
5 changes: 3 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def new_add_routes(self):
from .nodes.Clipseg import CLIPSeg,CombineMasks
from .nodes.ChatGPT import ChatGPTNode,ShowTextForGPT,CharacterInText
from .nodes.Audio import GamePal,SpeechRecognition,SpeechSynthesis
from .nodes.Utils import CreateCkptNames,CreateSeedNode,TESTNODE_,AppInfo,IntNumber,FloatSlider,TextInput,ColorInput,FontInput,TextToNumber,DynamicDelayProcessor,LimitNumber,SwitchByIndex,MultiplicationNode
from .nodes.Utils import CreateSampler_names,CreateCkptNames,CreateSeedNode,TESTNODE_,AppInfo,IntNumber,FloatSlider,TextInput,ColorInput,FontInput,TextToNumber,DynamicDelayProcessor,LimitNumber,SwitchByIndex,MultiplicationNode
from .nodes.Mask import OutlineMask,FeatheredMask


Expand Down Expand Up @@ -619,7 +619,8 @@ def new_add_routes(self):
"OutlineMask":OutlineMask,
"JoinWithDelimiter":JoinWithDelimiter,
"Seed_":CreateSeedNode,
"CkptNames_":CreateCkptNames
"CkptNames_":CreateCkptNames,
"SamplerNames_":CreateSampler_names
# "LaMaInpainting":LaMaInpainting
# "GamePal":GamePal
}
Expand Down
1 change: 1 addition & 0 deletions data/extension-node-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -4780,6 +4780,7 @@
"Color",
"Seed_",
"CkptNames_",
"SamplerNames_",
"CombineMasks_",
"EnhanceImage",
"GradientImage",
Expand Down
33 changes: 32 additions & 1 deletion nodes/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import matplotlib.font_manager as fm
import torch



def recursive_search(directory, excluded_dir_names=None):
if not os.path.isdir(directory):
return [], {}
Expand Down Expand Up @@ -765,4 +767,33 @@ def INPUT_TYPES(cls):
def run(self, ckpt_names):
ckpt_names=ckpt_names.split('\n')
ckpt_names = [name for name in ckpt_names if name.strip()]
return (ckpt_names,)
return (ckpt_names,)


class CreateSampler_names:
def __init__(self):
pass

@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"sampler_names": ("STRING",{"multiline": True,"default": "\n".join(comfy.samplers.KSampler.SAMPLERS),"dynamicPrompts": False}),
}
}

RETURN_TYPES = (any_type,)
RETURN_NAMES = ("sampler_names",)

INPUT_IS_LIST = False
OUTPUT_IS_LIST = (True,)

# OUTPUT_NODE = True
FUNCTION = "run"

CATEGORY = "♾️Mixlab/Utils"

def run(self, sampler_names):
sampler_names=sampler_names.split('\n')
sampler_names = [name for name in sampler_names if name.strip()]
return (sampler_names,)
6 changes: 6 additions & 0 deletions web/javascript/smart_connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ const smart_connect_config_input = [
node_widget_name: 'ckpt_name',
inputNodeName: 'CkptNames_',
inputNode_output_name: 'ckpt_names'
},
{
node_type: 'KSampler',
node_widget_name: 'sampler_name',
inputNodeName: 'SamplerNames_',
inputNode_output_name: 'sampler_names'
}
]

Expand Down

0 comments on commit a6cd383

Please sign in to comment.