Spaces:
Runtime error
Runtime error
polejowska
commited on
Commit
•
c81fbdf
1
Parent(s):
38c9666
Update app.py
Browse files
app.py
CHANGED
@@ -115,17 +115,17 @@ def detect_objects(
|
|
115 |
display_mask=display_mask,
|
116 |
mask=img_input_mask
|
117 |
)
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
|
125 |
return (
|
126 |
viz_img,
|
127 |
-
|
128 |
-
|
129 |
)
|
130 |
|
131 |
|
@@ -242,16 +242,16 @@ with gr.Blocks(css=css) as app:
|
|
242 |
with gr.Column():
|
243 |
img_output_from_upload = gr.Image(shape=(900, 900))
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
|
256 |
detect_button.click(
|
257 |
detect_objects,
|
@@ -271,8 +271,8 @@ with gr.Blocks(css=css) as app:
|
|
271 |
],
|
272 |
outputs=[
|
273 |
img_output_from_upload,
|
274 |
-
|
275 |
-
|
276 |
],
|
277 |
queue=True,
|
278 |
)
|
|
|
115 |
display_mask=display_mask,
|
116 |
mask=img_input_mask
|
117 |
)
|
118 |
+
decoder_attention_map_img = visualize_attention_map(
|
119 |
+
image_input, decoder_attention_map
|
120 |
+
)
|
121 |
+
encoder_attention_map_img = visualize_attention_map(
|
122 |
+
image_input, encoder_attention_map
|
123 |
+
)
|
124 |
|
125 |
return (
|
126 |
viz_img,
|
127 |
+
decoder_attention_map_img,
|
128 |
+
encoder_attention_map_img,
|
129 |
)
|
130 |
|
131 |
|
|
|
242 |
with gr.Column():
|
243 |
img_output_from_upload = gr.Image(shape=(900, 900))
|
244 |
|
245 |
+
with gr.TabItem("Attentions visualization"):
|
246 |
+
gr.Markdown("""Encoder attentions""")
|
247 |
+
with gr.Row():
|
248 |
+
encoder_att_map_output = gr.Image(shape=(850, 850))
|
249 |
+
gr.Markdown("""Decoder attentions""")
|
250 |
+
with gr.Row():
|
251 |
+
decoder_att_map_output = gr.Image(shape=(850, 850))
|
252 |
+
with gr.TabItem("Dataset details"):
|
253 |
+
with gr.Row():
|
254 |
+
gr.Markdown(description)
|
255 |
|
256 |
detect_button.click(
|
257 |
detect_objects,
|
|
|
271 |
],
|
272 |
outputs=[
|
273 |
img_output_from_upload,
|
274 |
+
decoder_att_map_output,
|
275 |
+
encoder_att_map_output,
|
276 |
],
|
277 |
queue=True,
|
278 |
)
|