1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 15:04:50 +08:00

Added to the websockets_api_example.py to show how to decode latent previews from the binary stream (#5016)

* Update websockets_api_example.py

* even more simplfied
This commit is contained in:
RandomGitUser321
2024-09-22 02:30:44 -04:00
committed by GitHub
parent 7a415f47a9
commit 13ecf10a92

View File

@@ -38,6 +38,9 @@ def get_images(ws, prompt):
if data['node'] is None and data['prompt_id'] == prompt_id:
break #Execution is done
else:
# If you want to be able to decode the binary stream for latent previews, here is how you can do it:
# bytesIO = BytesIO(out[8:])
# preview_image = Image.open(bytesIO) # This is your preview in PIL image format, store it in a global
continue #previews are binary data
history = get_history(prompt_id)[prompt_id]