Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,9 +21,9 @@ def generate_viz(image, class_index=None):
|
|
| 21 |
print(f"Image: {image.size}")
|
| 22 |
print(f"Class: {class_index}")
|
| 23 |
|
| 24 |
-
viz = do_explain(TRANSFORM, image, class_index=class_index)
|
| 25 |
viz.savefig("visualization.png")
|
| 26 |
-
return Image.open("visualization.png").convert("RGB")
|
| 27 |
|
| 28 |
title = "Explain ViT 😊"
|
| 29 |
|
|
@@ -32,7 +32,8 @@ iface = gr.Interface(fn=generate_viz, inputs=[
|
|
| 32 |
|
| 33 |
gr.Number(label="Class Index", info="Class index to explain"),
|
| 34 |
],
|
| 35 |
-
outputs=gr.Image(),
|
|
|
|
| 36 |
title=title,
|
| 37 |
allow_flagging="never",
|
| 38 |
cache_examples=True,
|
|
|
|
| 21 |
print(f"Image: {image.size}")
|
| 22 |
print(f"Class: {class_index}")
|
| 23 |
|
| 24 |
+
viz,pred = do_explain(TRANSFORM, image, class_index=class_index)
|
| 25 |
viz.savefig("visualization.png")
|
| 26 |
+
return Image.open("visualization.png").convert("RGB"), pred
|
| 27 |
|
| 28 |
title = "Explain ViT 😊"
|
| 29 |
|
|
|
|
| 32 |
|
| 33 |
gr.Number(label="Class Index", info="Class index to explain"),
|
| 34 |
],
|
| 35 |
+
outputs=[gr.Image(),
|
| 36 |
+
gr.text(),]
|
| 37 |
title=title,
|
| 38 |
allow_flagging="never",
|
| 39 |
cache_examples=True,
|