Spaces:
Runtime error
Runtime error
Upload render.py
Browse files
render.py
CHANGED
@@ -6,7 +6,6 @@ import urllib.parse
|
|
6 |
import random
|
7 |
from PIL import Image
|
8 |
import io
|
9 |
-
from termcolor import colored
|
10 |
import base64
|
11 |
import io
|
12 |
import os
|
@@ -46,13 +45,11 @@ def get_images(ws, prompt):
|
|
46 |
max_progress = data['max']
|
47 |
percentage = int((current_progress / max_progress) * 100)
|
48 |
if percentage >= last_reported_percentage + 10:
|
49 |
-
print(colored(f"Progress: {percentage}% in node {data['node']}", "yellow"))
|
50 |
last_reported_percentage = percentage
|
51 |
|
52 |
elif message['type'] == 'executing':
|
53 |
data = message['data']
|
54 |
if data['node'] is None and data['prompt_id'] == prompt_id:
|
55 |
-
print(colored("Execution complete.", "green"))
|
56 |
break # Execution is done
|
57 |
else:
|
58 |
continue # Previews are binary data
|
@@ -64,7 +61,6 @@ def get_images(ws, prompt):
|
|
64 |
if 'images' in node_output:
|
65 |
images_output = []
|
66 |
for image in node_output['images']:
|
67 |
-
print(colored(f"Downloading image: {image['filename']} from the server.", "yellow"))
|
68 |
image_data = get_image(image['filename'], image['subfolder'], image['type'])
|
69 |
images_output.append(image_data)
|
70 |
output_images[node_id] = images_output
|
|
|
6 |
import random
|
7 |
from PIL import Image
|
8 |
import io
|
|
|
9 |
import base64
|
10 |
import io
|
11 |
import os
|
|
|
45 |
max_progress = data['max']
|
46 |
percentage = int((current_progress / max_progress) * 100)
|
47 |
if percentage >= last_reported_percentage + 10:
|
|
|
48 |
last_reported_percentage = percentage
|
49 |
|
50 |
elif message['type'] == 'executing':
|
51 |
data = message['data']
|
52 |
if data['node'] is None and data['prompt_id'] == prompt_id:
|
|
|
53 |
break # Execution is done
|
54 |
else:
|
55 |
continue # Previews are binary data
|
|
|
61 |
if 'images' in node_output:
|
62 |
images_output = []
|
63 |
for image in node_output['images']:
|
|
|
64 |
image_data = get_image(image['filename'], image['subfolder'], image['type'])
|
65 |
images_output.append(image_data)
|
66 |
output_images[node_id] = images_output
|