Skip to content

Commit 13ecf10

Browse files
Added to the websockets_api_example.py to show how to decode latent previews from the binary stream (comfyanonymous#5016)
* Update websockets_api_example.py * even more simplfied
1 parent 7a415f4 commit 13ecf10

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

script_examples/websockets_api_example.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ def get_images(ws, prompt):
3838
if data['node'] is None and data['prompt_id'] == prompt_id:
3939
break #Execution is done
4040
else:
41+
# If you want to be able to decode the binary stream for latent previews, here is how you can do it:
42+
# bytesIO = BytesIO(out[8:])
43+
# preview_image = Image.open(bytesIO) # This is your preview in PIL image format, store it in a global
4144
continue #previews are binary data
4245

4346
history = get_history(prompt_id)[prompt_id]

0 commit comments

Comments
 (0)