Update app.py
Browse files
app.py
CHANGED
@@ -36,14 +36,14 @@ def run_dif(out_prompt):
|
|
36 |
img_buffer = io.BytesIO(r.content)
|
37 |
print (f'bytes:: {io.BytesIO(r.content)}')
|
38 |
str_equivalent_image = base64.b64encode(img_buffer.getvalue()).decode()
|
39 |
-
img_tag = "<img src='data:image/png;base64," + str_equivalent_image + "'/>"
|
40 |
out_html+=f"<div><a href='https://huggingface.co/models/{models[i]}'>{models[i]}</a><br>"+img_tag+"</div>"
|
41 |
out = Image.open(io.BytesIO(r.content))
|
42 |
out_box.append(out)
|
43 |
html_out = "<div class='grid_class'>"+out_html+"</div>"
|
44 |
yield out_box,html_out
|
45 |
except Exception as e:
|
46 |
-
out_html+=e
|
47 |
html_out = "<div class='grid_class'>"+out_html+"</div>"
|
48 |
|
49 |
yield out_box,html_out
|
@@ -51,6 +51,9 @@ css="""
|
|
51 |
.grid_class{
|
52 |
display:flex;
|
53 |
}
|
|
|
|
|
|
|
54 |
|
55 |
"""
|
56 |
with gr.Blocks(css=css) as app:
|
|
|
36 |
img_buffer = io.BytesIO(r.content)
|
37 |
print (f'bytes:: {io.BytesIO(r.content)}')
|
38 |
str_equivalent_image = base64.b64encode(img_buffer.getvalue()).decode()
|
39 |
+
img_tag = "<img class='img_class' src='data:image/png;base64," + str_equivalent_image + "'/>"
|
40 |
out_html+=f"<div><a href='https://huggingface.co/models/{models[i]}'>{models[i]}</a><br>"+img_tag+"</div>"
|
41 |
out = Image.open(io.BytesIO(r.content))
|
42 |
out_box.append(out)
|
43 |
html_out = "<div class='grid_class'>"+out_html+"</div>"
|
44 |
yield out_box,html_out
|
45 |
except Exception as e:
|
46 |
+
out_html+=str(e)
|
47 |
html_out = "<div class='grid_class'>"+out_html+"</div>"
|
48 |
|
49 |
yield out_box,html_out
|
|
|
51 |
.grid_class{
|
52 |
display:flex;
|
53 |
}
|
54 |
+
.img_class{
|
55 |
+
min-width:100px;
|
56 |
+
}
|
57 |
|
58 |
"""
|
59 |
with gr.Blocks(css=css) as app:
|