update preference
Browse files
app.py
CHANGED
|
@@ -222,6 +222,14 @@ def display_scenario(participant, choice):
|
|
| 222 |
gallery_state2: initial_images2,
|
| 223 |
sim_radio1: None,
|
| 224 |
sim_radio2: None,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
response1: VERBAL_MSG,
|
| 226 |
response2: VERBAL_MSG,
|
| 227 |
next_btn1: gr.update(interactive=False),
|
|
@@ -356,7 +364,7 @@ def save_response(participant, scenario, prompt, sim_radio, response, images_met
|
|
| 356 |
|
| 357 |
tabs = switch_tab(active_tab)
|
| 358 |
next_scenario = assigned_scenarios[1] if task1_success and task2_success else assigned_scenarios[0]
|
| 359 |
-
return [], [], None, VERBAL_MSG, prompt_state, next_state, redesign_state, submit_state, tabs, next_scenario
|
| 360 |
except Exception as e:
|
| 361 |
display_error_message(f"❌ Error saving response: {str(e)}")
|
| 362 |
return {submit_btn1: gr.skip()} if active_tab == "Task A" else {submit_btn2: gr.skip()}
|
|
@@ -542,7 +550,7 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "
|
|
| 542 |
########################################################################################################
|
| 543 |
|
| 544 |
participant.change(fn=set_user, inputs=[participant], outputs=[scenario])
|
| 545 |
-
scenario.change(display_scenario, inputs=[participant, scenario], outputs=[scenario_content, prompt, prompt1, prompt2, images_method1, images_method2, gallery_state1, gallery_state2, sim_radio1, sim_radio2, response1, response2, next_btn1, next_btn2, redesign_btn1, redesign_btn2, submit_btn1, submit_btn2])
|
| 546 |
prompt1.change(fn=reset_gallery, inputs=[], outputs=[gallery_state1])
|
| 547 |
prompt2.change(fn=reset_gallery, inputs=[], outputs=[gallery_state2])
|
| 548 |
next_btn1.click(fn=generate_image, inputs=[participant, scenario, prompt1, gallery_state1, active_tab], outputs=[images_method1])
|
|
@@ -566,11 +574,11 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "
|
|
| 566 |
)
|
| 567 |
submit_btn1.click(fn=save_response,
|
| 568 |
inputs=[participant, scenario, prompt1, sim_radio1, response1, images_method1, active_tab],
|
| 569 |
-
outputs=[images_method1, gallery_state1, sim_radio1, prompt1, response1, next_btn1, redesign_btn1, submit_btn1, tabs, scenario])
|
| 570 |
|
| 571 |
submit_btn2.click(fn=save_response,
|
| 572 |
inputs=[participant, scenario, prompt2, sim_radio2, response2, images_method2, active_tab],
|
| 573 |
-
outputs=[images_method2, gallery_state2, sim_radio2, prompt2, response2, next_btn2, redesign_btn2, submit_btn2, tabs, scenario])
|
| 574 |
|
| 575 |
|
| 576 |
if __name__ == "__main__":
|
|
|
|
| 222 |
gallery_state2: initial_images2,
|
| 223 |
sim_radio1: None,
|
| 224 |
sim_radio2: None,
|
| 225 |
+
dislike_radio1: None,
|
| 226 |
+
like_radio1: None,
|
| 227 |
+
dislike_radio2: None,
|
| 228 |
+
like_radio2: None,
|
| 229 |
+
like_image1: None,
|
| 230 |
+
dislike_image1: None,
|
| 231 |
+
like_image2: None,
|
| 232 |
+
dislike_image2: None,
|
| 233 |
response1: VERBAL_MSG,
|
| 234 |
response2: VERBAL_MSG,
|
| 235 |
next_btn1: gr.update(interactive=False),
|
|
|
|
| 364 |
|
| 365 |
tabs = switch_tab(active_tab)
|
| 366 |
next_scenario = assigned_scenarios[1] if task1_success and task2_success else assigned_scenarios[0]
|
| 367 |
+
return [], [], None, None, None, None, None, VERBAL_MSG, prompt_state, next_state, redesign_state, submit_state, tabs, next_scenario
|
| 368 |
except Exception as e:
|
| 369 |
display_error_message(f"❌ Error saving response: {str(e)}")
|
| 370 |
return {submit_btn1: gr.skip()} if active_tab == "Task A" else {submit_btn2: gr.skip()}
|
|
|
|
| 550 |
########################################################################################################
|
| 551 |
|
| 552 |
participant.change(fn=set_user, inputs=[participant], outputs=[scenario])
|
| 553 |
+
scenario.change(display_scenario, inputs=[participant, scenario], outputs=[scenario_content, prompt, prompt1, prompt2, images_method1, images_method2, gallery_state1, gallery_state2, sim_radio1, sim_radio2, dislike_radio1, like_radio1, dislike_radio2, like_radio2, like_image1, dislike_image1, like_image2, dislike_image2, response1, response2, next_btn1, next_btn2, redesign_btn1, redesign_btn2, submit_btn1, submit_btn2])
|
| 554 |
prompt1.change(fn=reset_gallery, inputs=[], outputs=[gallery_state1])
|
| 555 |
prompt2.change(fn=reset_gallery, inputs=[], outputs=[gallery_state2])
|
| 556 |
next_btn1.click(fn=generate_image, inputs=[participant, scenario, prompt1, gallery_state1, active_tab], outputs=[images_method1])
|
|
|
|
| 574 |
)
|
| 575 |
submit_btn1.click(fn=save_response,
|
| 576 |
inputs=[participant, scenario, prompt1, sim_radio1, response1, images_method1, active_tab],
|
| 577 |
+
outputs=[images_method1, gallery_state1, sim_radio1, dislike_radio1, like_radio1, like_image1, dislike_image1, prompt1, response1, next_btn1, redesign_btn1, submit_btn1, tabs, scenario])
|
| 578 |
|
| 579 |
submit_btn2.click(fn=save_response,
|
| 580 |
inputs=[participant, scenario, prompt2, sim_radio2, response2, images_method2, active_tab],
|
| 581 |
+
outputs=[images_method2, gallery_state2, sim_radio2, dislike_radio2, like_radio2, like_image2, dislike_image2, prompt2, response2, next_btn2, redesign_btn2, submit_btn2, tabs, scenario])
|
| 582 |
|
| 583 |
|
| 584 |
if __name__ == "__main__":
|