Spaces:
Sleeping
Sleeping
Kazuto Nakashima
commited on
Commit
•
4845cde
1
Parent(s):
a31cb74
update
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ with open("classes.txt") as f:
|
|
24 |
|
25 |
|
26 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
27 |
-
model = torchvision.models.
|
28 |
model.eval()
|
29 |
model.to(device)
|
30 |
|
@@ -100,13 +100,14 @@ with gr.Blocks(title="Grad-CAM") as demo:
|
|
100 |
gr.Markdown(
|
101 |
"""
|
102 |
# Grad-CAM
|
|
|
103 |
Upload an image and select a prediction to show the Grad-CAM heatmap.
|
104 |
"""
|
105 |
)
|
106 |
|
107 |
with gr.Row():
|
108 |
with gr.Column():
|
109 |
-
layer = gr.Dropdown(layer_choices, label="ResNet-
|
110 |
image = gr.Image(label="input", type="numpy")
|
111 |
label = gr.Label(num_top_classes=10, label="top-10 predictions")
|
112 |
exmpl = gr.Examples(["cat_dog.png"], image)
|
|
|
24 |
|
25 |
|
26 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
27 |
+
model = torchvision.models.resnet50(weights="DEFAULT")
|
28 |
model.eval()
|
29 |
model.to(device)
|
30 |
|
|
|
100 |
gr.Markdown(
|
101 |
"""
|
102 |
# Grad-CAM
|
103 |
+
Unofficial re-implementation of Grad-CAM (https://arxiv.org/abs/1610.02391).<br>
|
104 |
Upload an image and select a prediction to show the Grad-CAM heatmap.
|
105 |
"""
|
106 |
)
|
107 |
|
108 |
with gr.Row():
|
109 |
with gr.Column():
|
110 |
+
layer = gr.Dropdown(layer_choices, label="ResNet-50", value="layer4")
|
111 |
image = gr.Image(label="input", type="numpy")
|
112 |
label = gr.Label(num_top_classes=10, label="top-10 predictions")
|
113 |
exmpl = gr.Examples(["cat_dog.png"], image)
|