Spaces:
Sleeping
Sleeping
Commit
·
e1df11f
1
Parent(s):
4de52bd
change question position (before saliencymaps)
Browse files
app.py
CHANGED
|
@@ -61,6 +61,10 @@ def main():
|
|
| 61 |
gr.Markdown("Sidu")
|
| 62 |
gr.Markdown("Rise")
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
with gr.Row():
|
| 65 |
count = user_state if isinstance(user_state, int) else user_state.value
|
| 66 |
images = load_image_and_saliency(count, data_dir)
|
|
@@ -70,9 +74,7 @@ def main():
|
|
| 70 |
saliency_sidu = gr.Image(images[4], elem_classes="main-image", visible=False)
|
| 71 |
saliency_rise = gr.Image(images[3], elem_classes="main-image", visible=False)
|
| 72 |
|
| 73 |
-
|
| 74 |
-
row = concepts.iloc[count]
|
| 75 |
-
question = gr.Markdown(f"### Sort the following saliency maps according to which of them better highlights the following concepts: {row[1]}, {row[2]} , {row[3]}?", visible=False)
|
| 76 |
with gr.Row():
|
| 77 |
dropdown1 = gr.Dropdown(choices=options, label="grad-cam", visible=False)
|
| 78 |
dropdown2 = gr.Dropdown(choices=options, label="lime", visible=False)
|
|
@@ -156,7 +158,7 @@ def main():
|
|
| 156 |
dropdown2 = gr.Dropdown(choices=options, label="lime", visible=False)
|
| 157 |
dropdown3 = gr.Dropdown(choices=options, label="sidu", visible=False)
|
| 158 |
dropdown4 = gr.Dropdown(choices=options, label="rise", visible=False)
|
| 159 |
-
return target_img, saliency_gradcam, saliency_lime, saliency_sidu, saliency_rise,
|
| 160 |
|
| 161 |
|
| 162 |
def update_dropdowns():
|
|
@@ -170,7 +172,7 @@ def main():
|
|
| 170 |
concepts = load_csv_concepts(data_dir)
|
| 171 |
count = state if isinstance(state, int) else state.value
|
| 172 |
row = concepts.iloc[count]
|
| 173 |
-
return gr.Markdown(f"### Sort the following saliency maps according to which of them better highlights the following concepts: {row[1]}, {row[2]} , {row[3]}?", visible=True)
|
| 174 |
|
| 175 |
def redirect():
|
| 176 |
pass
|
|
@@ -245,7 +247,7 @@ def main():
|
|
| 245 |
outputs={continue_button, submit_button}
|
| 246 |
).then(
|
| 247 |
hide_view,
|
| 248 |
-
outputs={target_img, saliency_gradcam, saliency_lime, saliency_sidu, saliency_rise,
|
| 249 |
)
|
| 250 |
|
| 251 |
continue_button.click(
|
|
|
|
| 61 |
gr.Markdown("Sidu")
|
| 62 |
gr.Markdown("Rise")
|
| 63 |
|
| 64 |
+
count = user_state if isinstance(user_state, int) else user_state.value
|
| 65 |
+
row = concepts.iloc[count]
|
| 66 |
+
question = gr.Markdown(f"### Sort the following saliency maps according to which of them better highlights the following concepts for the class {class_names[user_state.value]}: {row[1]}, {row[2]} , {row[3]}?", visible=False)
|
| 67 |
+
|
| 68 |
with gr.Row():
|
| 69 |
count = user_state if isinstance(user_state, int) else user_state.value
|
| 70 |
images = load_image_and_saliency(count, data_dir)
|
|
|
|
| 74 |
saliency_sidu = gr.Image(images[4], elem_classes="main-image", visible=False)
|
| 75 |
saliency_rise = gr.Image(images[3], elem_classes="main-image", visible=False)
|
| 76 |
|
| 77 |
+
|
|
|
|
|
|
|
| 78 |
with gr.Row():
|
| 79 |
dropdown1 = gr.Dropdown(choices=options, label="grad-cam", visible=False)
|
| 80 |
dropdown2 = gr.Dropdown(choices=options, label="lime", visible=False)
|
|
|
|
| 158 |
dropdown2 = gr.Dropdown(choices=options, label="lime", visible=False)
|
| 159 |
dropdown3 = gr.Dropdown(choices=options, label="sidu", visible=False)
|
| 160 |
dropdown4 = gr.Dropdown(choices=options, label="rise", visible=False)
|
| 161 |
+
return question, target_img, saliency_gradcam, saliency_lime, saliency_sidu, saliency_rise, dropdown1, dropdown2, dropdown3, dropdown4
|
| 162 |
|
| 163 |
|
| 164 |
def update_dropdowns():
|
|
|
|
| 172 |
concepts = load_csv_concepts(data_dir)
|
| 173 |
count = state if isinstance(state, int) else state.value
|
| 174 |
row = concepts.iloc[count]
|
| 175 |
+
return gr.Markdown(f"### Sort the following saliency maps according to which of them better highlights the following concepts for the class {class_names[count]}: {row[1]}, {row[2]} , {row[3]}?", visible=True)
|
| 176 |
|
| 177 |
def redirect():
|
| 178 |
pass
|
|
|
|
| 247 |
outputs={continue_button, submit_button}
|
| 248 |
).then(
|
| 249 |
hide_view,
|
| 250 |
+
outputs={question, target_img, saliency_gradcam, saliency_lime, saliency_sidu, saliency_rise, dropdown1, dropdown2, dropdown3, dropdown4}
|
| 251 |
)
|
| 252 |
|
| 253 |
continue_button.click(
|