Spaces:
Runtime error
Runtime error
Commit
·
2dd8354
1
Parent(s):
e155345
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,16 +68,16 @@ def inference(input_img, see_misclassified=False,num_misclassified_imgs=0,see_gr
|
|
| 68 |
|
| 69 |
# top n classes only
|
| 70 |
sorted_confidences = {k: sorted_confidences[k] for k in list(sorted_confidences)[:top_classes]}
|
| 71 |
-
return sorted_confidences, visualization
|
| 72 |
|
| 73 |
-
title = "CIFAR10 trained on
|
| 74 |
-
description = "A
|
| 75 |
examples = [["examples/cat.jpg"], ["examples/plane.jpg"],["examples/dog.jpg"],["examples/truck.jpg"],["examples/bird.jpg"],["examples/ship.jpg"],["examples/horse.jpg"],["examples/frog.jpg"],["examples/deer.jpg"],["examples/car.jpg"]]
|
| 76 |
|
| 77 |
demo = gr.Interface(
|
| 78 |
inference,
|
| 79 |
-
inputs = [gr.Image(shape=(32, 32), label="Input Image"), gr.Checkbox(label="Misclassified"),gr.
|
| 80 |
-
outputs = [gr.Label(), gr.
|
| 81 |
title = title,
|
| 82 |
description = description,
|
| 83 |
examples = examples)
|
|
|
|
| 68 |
|
| 69 |
# top n classes only
|
| 70 |
sorted_confidences = {k: sorted_confidences[k] for k in list(sorted_confidences)[:top_classes]}
|
| 71 |
+
return sorted_confidences, [visualization]
|
| 72 |
|
| 73 |
+
title = "CIFAR10 trained on Custom ResNet Model with GradCAM"
|
| 74 |
+
description = "A Gradio interface to infer on ResNet model, and get GradCAM results"
|
| 75 |
examples = [["examples/cat.jpg"], ["examples/plane.jpg"],["examples/dog.jpg"],["examples/truck.jpg"],["examples/bird.jpg"],["examples/ship.jpg"],["examples/horse.jpg"],["examples/frog.jpg"],["examples/deer.jpg"],["examples/car.jpg"]]
|
| 76 |
|
| 77 |
demo = gr.Interface(
|
| 78 |
inference,
|
| 79 |
+
inputs = [gr.Image(shape=(32, 32), label="Input Image"), gr.Checkbox(label="Misclassified"),gr.Number(value=2,minimum=0,maximum=10,label="Total Misclassified Images"),gr.Checkbox(label="Gradcam"),gr.Number(value=2,minimum=0,maximum=10,label="Total GradCam Images"),gr.Slider(0, 1, value = 0.5, label="Opacity of GradCAM"), gr.Slider(-2, -1, value = -1, step=1, label="Which Layer?"), gr.Slider(1, 10, value=3, step=1, label="How many top classes?")],
|
| 80 |
+
outputs = [gr.Label(), gr.Gallery(label="Output Images", show_label=False, elem_id="gallery").style(columns=[2], rows=[5], object_fit="contain", height="auto")],
|
| 81 |
title = title,
|
| 82 |
description = description,
|
| 83 |
examples = examples)
|