Spaces:
Sleeping
Sleeping
phamngoctukts
commited on
Commit
•
9078b4e
1
Parent(s):
a580d61
Update render.py
Browse files
render.py
CHANGED
@@ -9,7 +9,7 @@ import io
|
|
9 |
import base64
|
10 |
import io
|
11 |
import os
|
12 |
-
|
13 |
server_address = os.environ.get("URL_API")
|
14 |
json_data=os.environ.get("JSON_API")
|
15 |
client_id = str(uuid.uuid4())
|
@@ -31,6 +31,7 @@ def get_history(prompt_id):
|
|
31 |
return json.loads(response.read())
|
32 |
|
33 |
def get_images(ws, prompt):
|
|
|
34 |
prompt_id = queue_prompt(prompt)['prompt_id']
|
35 |
output_images = {}
|
36 |
last_reported_percentage = 0
|
@@ -72,6 +73,7 @@ def pil_to_base64(image):
|
|
72 |
return f"data:image/png;base64,{base64_string}"
|
73 |
|
74 |
def generate_images(positive_prompt, image):
|
|
|
75 |
ws = websocket.WebSocket()
|
76 |
ws_url = f"ws://{server_address}/ws?clientId={client_id}"
|
77 |
ws.connect(ws_url)
|
|
|
9 |
import base64
|
10 |
import io
|
11 |
import os
|
12 |
+
import gradio as gr
|
13 |
server_address = os.environ.get("URL_API")
|
14 |
json_data=os.environ.get("JSON_API")
|
15 |
client_id = str(uuid.uuid4())
|
|
|
31 |
return json.loads(response.read())
|
32 |
|
33 |
def get_images(ws, prompt):
|
34 |
+
progress=gr.Progress(track_tqdm=True)
|
35 |
prompt_id = queue_prompt(prompt)['prompt_id']
|
36 |
output_images = {}
|
37 |
last_reported_percentage = 0
|
|
|
73 |
return f"data:image/png;base64,{base64_string}"
|
74 |
|
75 |
def generate_images(positive_prompt, image):
|
76 |
+
|
77 |
ws = websocket.WebSocket()
|
78 |
ws_url = f"ws://{server_address}/ws?clientId={client_id}"
|
79 |
ws.connect(ws_url)
|