Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -44,21 +44,25 @@ title = "CIFAR10 trained on ResNet18 Model with GradCAM"
|
|
44 |
description = "Gradio interface to infer on ResNet18 model, and get GradCAM results"
|
45 |
examples = [["cat.jpg", 0.5, -1], ["dog.jpg", 0.5, -1]]
|
46 |
demo = gr.Interface(
|
47 |
-
inference,
|
48 |
-
inputs = [gr.Image(shape=(32, 32), label="Input Image"), gr.Slider(0, 1, value = 0.5, label="Opacity of GradCAM"), gr.Slider(-2, -1, value = -2, step=1, label="Which Layer?")],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
outputs = [gr.Label(num_top_classes=3), gr.Image(shape=(32, 32), label="Output").style(width=128, height=128)],
|
50 |
-
|
51 |
-
description = description,
|
52 |
-
examples = examples,
|
53 |
)
|
54 |
demo.launch()
|
55 |
-
|
56 |
-
demo = gr.Interface(
|
57 |
-
inference,
|
58 |
-
inputs = [gr.Image(shape=(32, 32), label="Input Image"), gr.Slider(0, 1, value = 0.5, label="Opacity of GradCAM"), gr.Slider(-2, -1, value = -2, step=1, label="Which Layer?")],
|
59 |
-
outputs = [gr.Label(num_top_classes=3), gr.Image(shape=(32, 32), label="Output").style(width=128, height=128)],
|
60 |
-
title = title,
|
61 |
-
description = description,
|
62 |
-
examples = examples,
|
63 |
-
)
|
64 |
-
demo.launch()
|
|
|
44 |
description = "Gradio interface to infer on ResNet18 model, and get GradCAM results"
|
45 |
examples = [["cat.jpg", 0.5, -1], ["dog.jpg", 0.5, -1]]
|
46 |
demo = gr.Interface(
|
47 |
+
# inference,
|
48 |
+
# inputs = [gr.Image(shape=(32, 32), label="Input Image"), gr.Slider(0, 1, value = 0.5, label="Opacity of GradCAM"), gr.Slider(-2, -1, value = -2, step=1, label="Which Layer?")],
|
49 |
+
# outputs = [gr.Label(num_top_classes=3), gr.Image(shape=(32, 32), label="Output").style(width=128, height=128)],
|
50 |
+
# title = title,
|
51 |
+
# description = description,
|
52 |
+
# examples = examples,
|
53 |
+
fn=None, # We'll add the function later after defining all functions
|
54 |
+
inputs=[
|
55 |
+
gr.InterfaceChoice(["Yes", "No"], label="View GradCAM images?"),
|
56 |
+
gr.InterfaceNumber(label="Number of GradCAM images to view", default=5, min=1, max=10),
|
57 |
+
gr.InterfaceText(label="Layer name for GradCAM visualization", default="layer4", lines=1),
|
58 |
+
gr.InterfaceSlider(label="Opacity", min=0.1, max=1.0, default=0.5, step=0.1),
|
59 |
+
gr.InterfaceChoice(["Yes", "No"], label="View misclassified images?"),
|
60 |
+
gr.InterfaceNumber(label="Number of misclassified images to view", default=5, min=1, max=10),
|
61 |
+
gr.InterfaceChoice(["Upload New Images", "Example Images"], label="Select images source"),
|
62 |
+
gr.InterfaceImage("file" if "Interface" in gr.__file__ else "image", label="Uploaded image" if "Interface" in gr.__file__ else "Image"),
|
63 |
+
gr.InterfaceButton("Submit", label="View Images")
|
64 |
+
],
|
65 |
outputs = [gr.Label(num_top_classes=3), gr.Image(shape=(32, 32), label="Output").style(width=128, height=128)],
|
66 |
+
live=True
|
|
|
|
|
67 |
)
|
68 |
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|