Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -78,7 +78,8 @@ def inference_visualization(input_img, transparency = 0.5, target_layer_number =
|
|
78 |
# def gradio_callback(view_gradcam, num_gradcam_images, layer_name, opacity,
|
79 |
# view_misclassified, num_misclassified_images,
|
80 |
# input_img,submit):
|
81 |
-
def gradio_callback(view_grad_cam,
|
|
|
82 |
|
83 |
confidence = inference_confidences(input_img, transparency = 0.5, target_layer_number = -1)
|
84 |
visualization = inference_visualization(input_img, transparency = 0.5, target_layer_number = -1)
|
@@ -87,7 +88,7 @@ def gradio_callback(view_grad_cam, input_img, transparency = 0.5, target_layer_n
|
|
87 |
|
88 |
title = "CIFAR10 trained on ResNet18 Model with GradCAM"
|
89 |
description = "Gradio interface to infer on ResNet18 model, and get GradCAM results"
|
90 |
-
examples = [["Yes","cat.jpg", 0.5, -1], ["Yes","dog.jpg", 0.5, -1]]
|
91 |
|
92 |
demo = gr.Interface(
|
93 |
# inference,
|
@@ -110,6 +111,9 @@ demo = gr.Interface(
|
|
110 |
# gr.Image(shape=(32, 32), label="Input Image")
|
111 |
# gr.Radio(["Yes", "No"], label="View GradCAM images?"),
|
112 |
gr.Radio(["Yes", "No"], label="Location", info="GradCAM images?"),
|
|
|
|
|
|
|
113 |
gr.Image(shape=(32, 32), label="Input Image"),
|
114 |
gr.Slider(0, 1, value = 0.5, label="Opacity of GradCAM"),
|
115 |
gr.Slider(-2, -1, value = -2, step=1, label="Which Layer?")
|
|
|
78 |
# def gradio_callback(view_gradcam, num_gradcam_images, layer_name, opacity,
|
79 |
# view_misclassified, num_misclassified_images,
|
80 |
# input_img,submit):
|
81 |
+
def gradio_callback(view_grad_cam, num_gradcam_images, view_misclassified, num_misclassified_images,
|
82 |
+
input_img, transparency = 0.5, target_layer_number = -1):
|
83 |
|
84 |
confidence = inference_confidences(input_img, transparency = 0.5, target_layer_number = -1)
|
85 |
visualization = inference_visualization(input_img, transparency = 0.5, target_layer_number = -1)
|
|
|
88 |
|
89 |
title = "CIFAR10 trained on ResNet18 Model with GradCAM"
|
90 |
description = "Gradio interface to infer on ResNet18 model, and get GradCAM results"
|
91 |
+
examples = [["Yes",5,"Yes",5,"cat.jpg", 0.5, -1], ["Yes",5,"Yes",5,"dog.jpg", 0.5, -1]]
|
92 |
|
93 |
demo = gr.Interface(
|
94 |
# inference,
|
|
|
111 |
# gr.Image(shape=(32, 32), label="Input Image")
|
112 |
# gr.Radio(["Yes", "No"], label="View GradCAM images?"),
|
113 |
gr.Radio(["Yes", "No"], label="Location", info="GradCAM images?"),
|
114 |
+
gr.Number(label="Number of GradCAM images to view", default=5, max=10),
|
115 |
+
gr.Radio(["Yes", "No"], label="View misclassified images?"),
|
116 |
+
gr.Number(label="Number of misclassified images to view", default=5, min=1, max=10),
|
117 |
gr.Image(shape=(32, 32), label="Input Image"),
|
118 |
gr.Slider(0, 1, value = 0.5, label="Opacity of GradCAM"),
|
119 |
gr.Slider(-2, -1, value = -2, step=1, label="Which Layer?")
|