polejowska commited on
Commit
c81fbdf
1 Parent(s): 38c9666

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -115,17 +115,17 @@ def detect_objects(
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,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
- # 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,8 +271,8 @@ with gr.Blocks(css=css) as app:
271
  ],
272
  outputs=[
273
  img_output_from_upload,
274
- #decoder_att_map_output,
275
- #encoder_att_map_output,
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
  )