Commit
•
e0bd059
1
Parent(s):
efbe3a2
Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,12 @@ def infer(prompt, negative="low_quality", scale=7, profile: gr.OAuthProfile | No
|
|
29 |
start_time = time.time()
|
30 |
images_request = requests.post(url, json = payload)
|
31 |
print(time.time() - start_time)
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
33 |
image_b64 = (f"data:image/jpeg;base64,{image}")
|
34 |
images.append(image_b64)
|
35 |
|
@@ -328,5 +333,5 @@ with gr.Blocks(css=css) as block_with_history:
|
|
328 |
with gr.Tab("Past generations"):
|
329 |
user_history.render()
|
330 |
|
331 |
-
block_with_history.queue(concurrency_count=
|
332 |
#block_with_history.launch(server_name="0.0.0.0")
|
|
|
29 |
start_time = time.time()
|
30 |
images_request = requests.post(url, json = payload)
|
31 |
print(time.time() - start_time)
|
32 |
+
try:
|
33 |
+
json_data = images_request.json()
|
34 |
+
except requests.exceptions.JSONDecodeError:
|
35 |
+
raise gr.Error("SDXL did not return a valid result, try again")
|
36 |
+
|
37 |
+
for image in json_data["images"]:
|
38 |
image_b64 = (f"data:image/jpeg;base64,{image}")
|
39 |
images.append(image_b64)
|
40 |
|
|
|
333 |
with gr.Tab("Past generations"):
|
334 |
user_history.render()
|
335 |
|
336 |
+
block_with_history.queue(concurrency_count=6, max_size=10, api_open=False).launch(show_api=False)
|
337 |
#block_with_history.launch(server_name="0.0.0.0")
|