mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-10 10:53:30 +08:00
Update websockets_api_example.py
This commit is contained in:
parent
364b69e931
commit
eb8b496b96
@ -38,6 +38,12 @@ def get_images(ws, prompt):
|
|||||||
if data['node'] is None and data['prompt_id'] == prompt_id:
|
if data['node'] is None and data['prompt_id'] == prompt_id:
|
||||||
break #Execution is done
|
break #Execution is done
|
||||||
else:
|
else:
|
||||||
|
# If you want to be able to decode the binary stream for latent previews, here is how you can do it:
|
||||||
|
# event = struct.unpack(">I", out[:4])[0]
|
||||||
|
# image_data = out[8:]
|
||||||
|
# if event == 1:
|
||||||
|
# bytesIO = BytesIO(image_data)
|
||||||
|
# preview_image = Image.open(bytesIO) # This is your preview in PIL image format, store it in a global
|
||||||
continue #previews are binary data
|
continue #previews are binary data
|
||||||
|
|
||||||
history = get_history(prompt_id)[prompt_id]
|
history = get_history(prompt_id)[prompt_id]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user