ComfyScript
ComfyScript copied to clipboard
Simplify for newbies
Please abstract/merge some of the methods for newbies.
For example?
These methods are one-to-one mappings of ComfyUI nodes. If one wants some all-in-one methods, many custom node packs are available.
For example all that noise, vae encoding/decoding and sampling bs can be just one node (or just one method), same for controlnets (load controlnet,apply controlnet)
This can be simply done by defining functions:
def sample(model_name: CheckpointLoader.ckpt_name, pos: str, neg: str, seed: int = 0, steps: int = 20) -> Image:
model, clip, vae = CheckpointLoaderSimple(model_name)
latent = EmptyLatentImage(512, 512, 1)
latent = KSampler(model, seed, steps, 8, 'euler', 'normal', CLIPTextEncode(pos, clip), CLIPTextEncode(neg, clip), latent, 1)
return VAEDecode(latent, vae)
with Workflow():
pos = 'beautiful scenery nature glass bottle landscape, , purple galaxy bottle,'
neg = 'text, watermark'
image = sample(model_name=Checkpoints.v1_5_pruned_emaonly, pos=pos, neg=neg, seed=123)
SaveImage(image, f'test')
But I'm hesitant to introduce things like this, because they can be very personal. If a person doesn't know how to code the workflow, he can just copy someone else's workflow and use it; if he does know, he may not need these as much because they're not flexible enough.
If you are interested in this, you can create a repository and put your utility functions there. I'll add a link to it in the readme, or just make it installed by default.
I might fork it if only it has a separate unified comfy core, not a bunch of scripts