Update app.py
Browse files
app.py
CHANGED
@@ -17,21 +17,24 @@ print (loaded_model)
|
|
17 |
def run_dif(out_prompt):
|
18 |
out_box=[]
|
19 |
for i,ea in enumerate(loaded_model):
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
35 |
with gr.Blocks() as app:
|
36 |
inp=gr.Textbox()
|
37 |
outp=gr.Gallery()
|
|
|
17 |
def run_dif(out_prompt):
|
18 |
out_box=[]
|
19 |
for i,ea in enumerate(loaded_model):
|
20 |
+
try:
|
21 |
+
print (ea)
|
22 |
+
model=loaded_model[int(i)]
|
23 |
+
out_img=model(out_prompt)
|
24 |
+
print(out_img)
|
25 |
+
url=f'https://omnibus-top-20.hf.space/file={out_img}'
|
26 |
+
print(url)
|
27 |
+
uid = uuid.uuid4()
|
28 |
+
#urllib.request.urlretrieve(image, 'tmp.png')
|
29 |
+
#out=Image.open('tmp.png')
|
30 |
+
r = requests.get(url, stream=True)
|
31 |
+
if r.status_code == 200:
|
32 |
+
print (f'bytes:: {io.BytesIO(r.content)}')
|
33 |
+
out = Image.open(io.BytesIO(r.content))
|
34 |
+
out_box.append(out)
|
35 |
+
yield out_box
|
36 |
+
except Exception:
|
37 |
+
yield out_box
|
38 |
with gr.Blocks() as app:
|
39 |
inp=gr.Textbox()
|
40 |
outp=gr.Gallery()
|