Spaces:
Runtime error
Runtime error
polejowska
commited on
Commit
•
7f7eaee
1
Parent(s):
3370ff8
Update app.py
Browse files
app.py
CHANGED
@@ -38,6 +38,7 @@ def detect_objects(model_name, image_input, threshold):
|
|
38 |
|
39 |
if "DETR" in model_name:
|
40 |
model = DetrForObjectDetection.from_pretrained(MODELS_REPO[model_name])
|
|
|
41 |
elif "YOLOS" in model_name:
|
42 |
model = YolosForObjectDetection.from_pretrained(MODELS_REPO[model_name])
|
43 |
|
@@ -64,9 +65,7 @@ def detect_objects(model_name, image_input, threshold):
|
|
64 |
decoder_attention_map_img,
|
65 |
encoder_attention_map_img,
|
66 |
cross_attention_map_img,
|
67 |
-
|
68 |
-
gr.outputs.Image(type='file', label=f'attention_head_2'),
|
69 |
-
gr.outputs.Image(type='file', label=f'attention_head_3'),
|
70 |
)
|
71 |
|
72 |
|
@@ -121,6 +120,9 @@ with gr.Blocks(css=css) as app:
|
|
121 |
with gr.Column():
|
122 |
gr.Markdown("""Cross attentions""")
|
123 |
cross_att_map_output = gr.Image(shape=(850, 850))
|
|
|
|
|
|
|
124 |
|
125 |
detect_button.click(
|
126 |
detect_objects,
|
@@ -130,6 +132,7 @@ with gr.Blocks(css=css) as app:
|
|
130 |
decoder_att_map_output,
|
131 |
encoder_att_map_output,
|
132 |
cross_att_map_output,
|
|
|
133 |
],
|
134 |
queue=True,
|
135 |
)
|
|
|
38 |
|
39 |
if "DETR" in model_name:
|
40 |
model = DetrForObjectDetection.from_pretrained(MODELS_REPO[model_name])
|
41 |
+
model_details = "DETR details"
|
42 |
elif "YOLOS" in model_name:
|
43 |
model = YolosForObjectDetection.from_pretrained(MODELS_REPO[model_name])
|
44 |
|
|
|
65 |
decoder_attention_map_img,
|
66 |
encoder_attention_map_img,
|
67 |
cross_attention_map_img,
|
68 |
+
model_details
|
|
|
|
|
69 |
)
|
70 |
|
71 |
|
|
|
120 |
with gr.Column():
|
121 |
gr.Markdown("""Cross attentions""")
|
122 |
cross_att_map_output = gr.Image(shape=(850, 850))
|
123 |
+
with gr.TabItem("Model details"):
|
124 |
+
with gr.Row():
|
125 |
+
model_details = gr.Markdown(""" """)
|
126 |
|
127 |
detect_button.click(
|
128 |
detect_objects,
|
|
|
132 |
decoder_att_map_output,
|
133 |
encoder_att_map_output,
|
134 |
cross_att_map_output,
|
135 |
+
model_details,
|
136 |
],
|
137 |
queue=True,
|
138 |
)
|