patrickvonplaten
commited on
Commit
•
e3f532e
1
Parent(s):
781f2a7
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import base64
|
|
5 |
import re
|
6 |
import os
|
7 |
import requests
|
|
|
8 |
from PIL import Image
|
9 |
from io import BytesIO
|
10 |
|
@@ -22,7 +23,9 @@ def infer(prompt, negative="low_quality", scale=7, profile: gr.OAuthProfile | No
|
|
22 |
images = []
|
23 |
url = os.getenv('JAX_BACKEND_URL')
|
24 |
payload = {'prompt': prompt, 'negative_prompt': negative, 'guidance_scale': scale}
|
|
|
25 |
images_request = requests.post(url, json = payload)
|
|
|
26 |
for image in images_request.json()["images"]:
|
27 |
image_b64 = (f"data:image/jpeg;base64,{image}")
|
28 |
images.append(image_b64)
|
|
|
5 |
import re
|
6 |
import os
|
7 |
import requests
|
8 |
+
import time
|
9 |
from PIL import Image
|
10 |
from io import BytesIO
|
11 |
|
|
|
23 |
images = []
|
24 |
url = os.getenv('JAX_BACKEND_URL')
|
25 |
payload = {'prompt': prompt, 'negative_prompt': negative, 'guidance_scale': scale}
|
26 |
+
start_time = time.time()
|
27 |
images_request = requests.post(url, json = payload)
|
28 |
+
print(time.time() - start_time)
|
29 |
for image in images_request.json()["images"]:
|
30 |
image_b64 = (f"data:image/jpeg;base64,{image}")
|
31 |
images.append(image_b64)
|