Open sneccc opened 1 month ago
In virtual mode, the output of nodes can't be directly used as normal Python values, see #29 for details.
However, you don't actually need to use BatchCount
and ImageFromBatch
, use PreviewImage(final_image).wait().wait()
and it will return a list of images:
from PIL import Image
image = EmptyImage(512, 512, 1)
image = PreviewImage(image)
image_batch = image.wait()
# Get the first image
image: Image.Image = image_batch[0]
# Get all images in the batch
images: list[Image.Image] = image_batch.wait()
batch_count = len(images)
Damn that was fast, thanks!
import comfy_script.ui as ui
queue.watch_display(False)
images = []
titles = []
def gen(steps: int):
pos = 'beautiful scenery nature glass bottle landscape, purple galaxy bottle, fractal, nested images'
neg = 'text, watermark, blurry, low quality'
latent = EmptyLatentImage(512, 512, 1)
model, clip, vae = CheckpointLoaderSimple(ckpt_name=CheckpointLoader.ckpt_name.sd15_Deliberate_v3)
latent = KSampler(model, 123, steps, 7, sampler_name=SamplerSelector.sampler_name.euler_ancestral,
positive=CLIPTextEncode(pos, clip), negative=CLIPTextEncode(neg, clip),
latent_image=latent, denoise=1)
image = VAEDecode(latent, vae)
return PreviewImage(image).wait()
with Workflow():
for x in [10,20,30,50,80]:
title = f'steps {x}'
#print(title)
images.append(gen(x))
titles.append(title)
ui.ipy.ImageViewer(images, titles=titles)
how do i prevent unnecessary logging and btw do u have discord?
how do i prevent unnecessary logging
These progress bars are not from ComfyScript, but ComfyUI itself. To avoid them, you can launch ComfyUI in a separate process and connect it with load()
/load('http://127.0.0.1:8188/')
. Alternatively,
load()
import comfy.utils
comfy.utils.set_progress_bar_enabled(False)
and btw do u have discord?
this doesn't seem to work it opens discord web but doesn't trigger any add popup give me your username instead
chaoses_ib
Edit: Server https://discord.gg/arqJbtEg7w
Cant use Int returned by comfy script as a normal python int