Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,13 +4,10 @@ from generic import save_image_vis
|
|
| 4 |
|
| 5 |
|
| 6 |
def generate_viz(URL, question):
|
| 7 |
-
|
| 8 |
print(f"Input Image URL: {URL}")
|
| 9 |
print(f"Target Class: {question}")
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
return img, answer, html_page
|
| 14 |
|
| 15 |
title = "Explain LXMERT 🤯"
|
| 16 |
|
|
@@ -19,7 +16,10 @@ iface = gr.Interface(fn=generate_viz, inputs=[
|
|
| 19 |
gr.Text(label="Input Image URL"),
|
| 20 |
gr.Text(label="Input the Question"),
|
| 21 |
],
|
| 22 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
| 23 |
title=title,
|
| 24 |
allow_flagging="never",
|
| 25 |
cache_examples=True,
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
def generate_viz(URL, question):
|
|
|
|
| 7 |
print(f"Input Image URL: {URL}")
|
| 8 |
print(f"Target Class: {question}")
|
| 9 |
+
oring, img, html_page, answer = save_image_vis(URL, question)
|
| 10 |
+
return answer, oring, img, html_page
|
|
|
|
|
|
|
| 11 |
|
| 12 |
title = "Explain LXMERT 🤯"
|
| 13 |
|
|
|
|
| 16 |
gr.Text(label="Input Image URL"),
|
| 17 |
gr.Text(label="Input the Question"),
|
| 18 |
],
|
| 19 |
+
outputs=[gr.Text(label="Answer"),
|
| 20 |
+
gr.Image(label="Oringinal Image", width=450, height=300),
|
| 21 |
+
gr.Image(label="EXplain Image", width=450, height=300),
|
| 22 |
+
gr.HTML(label="Visualize Sentence Importance"), ],
|
| 23 |
title=title,
|
| 24 |
allow_flagging="never",
|
| 25 |
cache_examples=True,
|