Image_Gen_Server/script_examples/tempCodeRunnerFile.py

8 lines
372 B
Python
Raw Permalink Normal View History

2024-10-24 15:40:15 +00:00
ws = websocket.WebSocket()
ws.connect("ws://{}/ws?clientId={}".format(server_address, client_id))
images = get_images(ws, prompt)
for node_id in images:
for idx, image_data in enumerate(images[node_id]):
image = Image.open(io.BytesIO(image_data))
image_path = os.path.join(info['expo_raw_sd_dir'], f"{node_id}_{idx}.png")
image.save(image_path)