amitkayal commited on
Commit
c480201
·
1 Parent(s): c2d50fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -75,9 +75,11 @@ def inference_visualization(input_img, transparency = 0.5, target_layer_number =
75
  return visualization
76
 
77
  # Callback function for the Gradio interface
78
- def gradio_callback(view_gradcam, num_gradcam_images, layer_name, opacity,
79
- view_misclassified, num_misclassified_images,
80
- input_img,submit):
 
 
81
  confidence = inference_confidences(input_img, transparency = 0.5, target_layer_number = -1)
82
  visualization = inference_visualization(input_img, transparency = 0.5, target_layer_number = -1)
83
  return confidence, visualization
@@ -99,14 +101,17 @@ demo = gr.Interface(
99
  # examples = examples,
100
  fn=gradio_callback, # We'll add the function later after defining all functions, # We'll add the function later after defining all functions
101
  inputs=[
102
- gr.Radio(["Yes", "No"], label="View GradCAM images?"),
103
- gr.Number(label="Number of GradCAM images to view", default=5, max=10),
104
- gr.Slider(-2, -1, value = -2, step=1, label="Which Layer?"),
105
- gr.Slider(minimum=0.1, maximum=1.0, step=0.1, default=0.5, label="Opacity"),
106
- gr.Radio(["Yes", "No"], label="View misclassified images?"),
107
- gr.Number(label="Number of misclassified images to view", default=5, min=1, max=10),
108
- gr.Image(shape=(32, 32), label="Input Image")
109
- # gr.Button(label="Submit", type="boolean")
 
 
 
110
  ],
111
  outputs = [gr.Label(num_top_classes=3), gr.Image(shape=(32, 32), label="Output").style(width=128, height=128)],
112
  examples = examples,
 
75
  return visualization
76
 
77
  # Callback function for the Gradio interface
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(input_img, transparency = 0.5, target_layer_number = -1):
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)
85
  return confidence, visualization
 
101
  # examples = examples,
102
  fn=gradio_callback, # We'll add the function later after defining all functions, # We'll add the function later after defining all functions
103
  inputs=[
104
+ # gr.Radio(["Yes", "No"], label="View GradCAM images?"),
105
+ # gr.Number(label="Number of GradCAM images to view", default=5, max=10),
106
+ # gr.Slider(-2, -1, value = -2, step=1, label="Which Layer?"),
107
+ # gr.Slider(minimum=0.1, maximum=1.0, step=0.1, default=0.5, label="Opacity"),
108
+ # gr.Radio(["Yes", "No"], label="View misclassified images?"),
109
+ # gr.Number(label="Number of misclassified images to view", default=5, min=1, max=10),
110
+ # gr.Image(shape=(32, 32), label="Input Image")
111
+ gr.Image(shape=(32, 32), label="Input Image"),
112
+ gr.Slider(0, 1, value = 0.5, label="Opacity of GradCAM"),
113
+ gr.Slider(-2, -1, value = -2, step=1, label="Which Layer?")
114
+
115
  ],
116
  outputs = [gr.Label(num_top_classes=3), gr.Image(shape=(32, 32), label="Output").style(width=128, height=128)],
117
  examples = examples,