Spaces:
Sleeping
Sleeping
Commit ·
ca23732
1
Parent(s): 744978f
Improve UI
Browse files
app.py
CHANGED
|
@@ -19,7 +19,8 @@ class GradioApp:
|
|
| 19 |
with gr.Blocks() as self.app:
|
| 20 |
# Inference
|
| 21 |
with gr.Box():
|
| 22 |
-
gr.Markdown("#
|
|
|
|
| 23 |
with gr.Row():
|
| 24 |
with gr.Column(scale=1):
|
| 25 |
image = gr.Image(type="pil", label="Input Image", height=200)
|
|
@@ -44,10 +45,12 @@ class GradioApp:
|
|
| 44 |
|
| 45 |
# Visualize activation maps
|
| 46 |
with gr.Box():
|
| 47 |
-
gr.Markdown("#
|
|
|
|
|
|
|
| 48 |
with gr.Row():
|
| 49 |
with gr.Column(scale=1):
|
| 50 |
-
chosen_layer = gr.Dropdown(label="Layer",
|
| 51 |
chosen_filter = gr.Slider(label="Filter", info="Choose from the filters", interactive=True)
|
| 52 |
color = gr.Radio(["heatmap", "gray"], value="heatmap", label="Color", info="Choose the color of the activation map")
|
| 53 |
|
|
@@ -56,7 +59,10 @@ class GradioApp:
|
|
| 56 |
|
| 57 |
# Visualize input gradient
|
| 58 |
with gr.Box():
|
| 59 |
-
gr.Markdown("#
|
|
|
|
|
|
|
|
|
|
| 60 |
with gr.Row():
|
| 61 |
with gr.Column(scale=1):
|
| 62 |
input_grad = gr.Image(type="pil", label="Input Gradient", height=300)
|
|
@@ -68,7 +74,7 @@ class GradioApp:
|
|
| 68 |
|
| 69 |
# Set up callbacks
|
| 70 |
reset_button.add([image, input_grad, probs, activation_map,
|
| 71 |
-
|
| 72 |
|
| 73 |
run_button.click(
|
| 74 |
self.run,
|
|
|
|
| 19 |
with gr.Blocks() as self.app:
|
| 20 |
# Inference
|
| 21 |
with gr.Box():
|
| 22 |
+
gr.Markdown("# Run inference")
|
| 23 |
+
with gr.Box():
|
| 24 |
with gr.Row():
|
| 25 |
with gr.Column(scale=1):
|
| 26 |
image = gr.Image(type="pil", label="Input Image", height=200)
|
|
|
|
| 45 |
|
| 46 |
# Visualize activation maps
|
| 47 |
with gr.Box():
|
| 48 |
+
gr.Markdown("# Visualize activation maps")
|
| 49 |
+
gr.Markdown("Choose a layer and a filter to visualize the activation map.")
|
| 50 |
+
with gr.Box():
|
| 51 |
with gr.Row():
|
| 52 |
with gr.Column(scale=1):
|
| 53 |
+
chosen_layer = gr.Dropdown(label="Layer", info="Choose from the layers", interactive=True)
|
| 54 |
chosen_filter = gr.Slider(label="Filter", info="Choose from the filters", interactive=True)
|
| 55 |
color = gr.Radio(["heatmap", "gray"], value="heatmap", label="Color", info="Choose the color of the activation map")
|
| 56 |
|
|
|
|
| 59 |
|
| 60 |
# Visualize input gradient
|
| 61 |
with gr.Box():
|
| 62 |
+
gr.Markdown("# Visualize input gradient")
|
| 63 |
+
gr.Markdown("Compute the input gradient. Visualize the spatial region of the input image that contributes to the prediction.")
|
| 64 |
+
gr.Markdown("Change the scale to adjust the opactiy of the heatmap.")
|
| 65 |
+
with gr.Box():
|
| 66 |
with gr.Row():
|
| 67 |
with gr.Column(scale=1):
|
| 68 |
input_grad = gr.Image(type="pil", label="Input Gradient", height=300)
|
|
|
|
| 74 |
|
| 75 |
# Set up callbacks
|
| 76 |
reset_button.add([image, input_grad, probs, activation_map,
|
| 77 |
+
input_grad, grad_applied, chosen_layer, chosen_filter])
|
| 78 |
|
| 79 |
run_button.click(
|
| 80 |
self.run,
|