Spaces:
Runtime error
Runtime error
Add main
Browse files
app.py
CHANGED
|
@@ -97,17 +97,18 @@ def inference(img):
|
|
| 97 |
|
| 98 |
return resnet_label, cam_result, vit_label, rollout_result
|
| 99 |
|
| 100 |
-
|
| 101 |
-
interface = gr.Interface(
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
| 97 |
|
| 98 |
return resnet_label, cam_result, vit_label, rollout_result
|
| 99 |
|
| 100 |
+
if __name__ == "__main__":
|
| 101 |
+
interface = gr.Interface(
|
| 102 |
+
fn=inference,
|
| 103 |
+
inputs=gr.inputs.Image(type="pil", label="Input Image"),
|
| 104 |
+
outputs=[
|
| 105 |
+
gr.outputs.Label(num_top_classes=1, type="auto", label="ResNet Label"),
|
| 106 |
+
gr.outputs.Image(type="auto", label="ResNet CAM"),
|
| 107 |
+
gr.outputs.Label(num_top_classes=1, type="auto", label="ViT Label"),
|
| 108 |
+
gr.outputs.Image(type="auto", label="Rollout Attn Flow"),
|
| 109 |
+
],
|
| 110 |
+
examples=examples,
|
| 111 |
+
title="CNN - Transformer Explainability",
|
| 112 |
+
live=True,
|
| 113 |
+
)
|
| 114 |
+
interface.launch()
|