update scenarios
Browse files
__pycache__/live_preview_helpers.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/live_preview_helpers.cpython-310.pyc and b/__pycache__/live_preview_helpers.cpython-310.pyc differ
|
|
|
__pycache__/optim_utils.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/optim_utils.cpython-310.pyc and b/__pycache__/optim_utils.cpython-310.pyc differ
|
|
|
__pycache__/utils.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/utils.cpython-310.pyc and b/__pycache__/utils.cpython-310.pyc differ
|
|
|
app.py
CHANGED
|
@@ -172,12 +172,12 @@ def set_user(participant):
|
|
| 172 |
global responses_memory, assigned_scenarios
|
| 173 |
responses_memory[participant] = {METHODS[0]:{}, METHODS[1]:{}}
|
| 174 |
|
| 175 |
-
id = re.findall(r'\d+', participant)
|
| 176 |
-
if len(id) == 0 or int(id[0]) % 2 == 0: # name invalid, assign first half scenarios
|
| 177 |
-
|
| 178 |
-
else:
|
| 179 |
-
|
| 180 |
-
return assigned_scenarios[0]
|
| 181 |
|
| 182 |
def display_scenario(participant, choice):
|
| 183 |
# reset intermittent storage when scenario change
|
|
@@ -332,14 +332,14 @@ def save_response(participant, scenario, prompt, sim_radio, like_radio, dislike_
|
|
| 332 |
|
| 333 |
|
| 334 |
# decide if change scenario
|
| 335 |
-
if scenario == assigned_scenarios[0]:
|
| 336 |
-
|
| 337 |
-
else:
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
|
| 344 |
# reset buttons
|
| 345 |
prompt_state = gr.update(interactive=False)
|
|
@@ -348,7 +348,7 @@ def save_response(participant, scenario, prompt, sim_radio, like_radio, dislike_
|
|
| 348 |
redesign_state = gr.update(interactive=False)
|
| 349 |
tabs = switch_tab(active_tab)
|
| 350 |
|
| 351 |
-
return None, None, None, prompt_state, next_state, redesign_state, submit_state,
|
| 352 |
|
| 353 |
except Exception as e:
|
| 354 |
display_error_message(f"β Error saving response: {str(e)}")
|
|
@@ -400,7 +400,7 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "
|
|
| 400 |
choices=list(SCENARIOS.keys()),
|
| 401 |
value=None,
|
| 402 |
label="π Scenario",
|
| 403 |
-
interactive=False,
|
| 404 |
)
|
| 405 |
scenario_content = gr.Textbox(
|
| 406 |
label="π Background",
|
|
@@ -524,7 +524,8 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "
|
|
| 524 |
# Button Function Setup
|
| 525 |
########################################################################################################
|
| 526 |
|
| 527 |
-
participant.change(fn=set_user, inputs=[participant], outputs=[scenario])
|
|
|
|
| 528 |
scenario.change(display_scenario,
|
| 529 |
inputs=[participant, scenario],
|
| 530 |
outputs=[scenario_content, prompt1, prompt2, images_method1, images_method2, like_image1, dislike_image1, like_image2, dislike_image2, history_images1, history_images2, example1.dataset, example2.dataset, next_btn1, next_btn2, redesign_btn1, redesign_btn2, submit_btn1, submit_btn2])
|
|
@@ -552,11 +553,11 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Inconsolata"), "
|
|
| 552 |
)
|
| 553 |
submit_btn1.click(fn=save_response,
|
| 554 |
inputs=[participant, scenario, prompt1, sim_radio1, like_radio1, dislike_radio1, active_tab],
|
| 555 |
-
outputs=[sim_radio1, dislike_radio1, like_radio1, prompt1, next_btn1, redesign_btn1, submit_btn1,
|
| 556 |
|
| 557 |
submit_btn2.click(fn=save_response,
|
| 558 |
inputs=[participant, scenario, prompt2, sim_radio2, like_radio2, dislike_radio2, active_tab],
|
| 559 |
-
outputs=[sim_radio2, dislike_radio2, like_radio2, prompt2, next_btn2, redesign_btn2, submit_btn2,
|
| 560 |
|
| 561 |
|
| 562 |
if __name__ == "__main__":
|
|
|
|
| 172 |
global responses_memory, assigned_scenarios
|
| 173 |
responses_memory[participant] = {METHODS[0]:{}, METHODS[1]:{}}
|
| 174 |
|
| 175 |
+
# id = re.findall(r'\d+', participant)
|
| 176 |
+
# if len(id) == 0 or int(id[0]) % 2 == 0: # name invalid, assign first half scenarios
|
| 177 |
+
# assigned_scenarios = list(SCENARIOS.keys())[:2]
|
| 178 |
+
# else:
|
| 179 |
+
# assigned_scenarios = list(SCENARIOS.keys())[2:]
|
| 180 |
+
# return assigned_scenarios[0]
|
| 181 |
|
| 182 |
def display_scenario(participant, choice):
|
| 183 |
# reset intermittent storage when scenario change
|
|
|
|
| 332 |
|
| 333 |
|
| 334 |
# decide if change scenario
|
| 335 |
+
# if scenario == assigned_scenarios[0]:
|
| 336 |
+
# next_scenario = assigned_scenarios[1] if task1_success and task2_success else assigned_scenarios[0]
|
| 337 |
+
# else:
|
| 338 |
+
# if task1_success and task2_success:
|
| 339 |
+
# display_info_message("You have finished all scenarios, thank you!")
|
| 340 |
+
# next_scenario = assigned_scenarios[0]
|
| 341 |
+
# else:
|
| 342 |
+
# next_scenario = assigned_scenarios[1]
|
| 343 |
|
| 344 |
# reset buttons
|
| 345 |
prompt_state = gr.update(interactive=False)
|
|
|
|
| 348 |
redesign_state = gr.update(interactive=False)
|
| 349 |
tabs = switch_tab(active_tab)
|
| 350 |
|
| 351 |
+
return None, None, None, prompt_state, next_state, redesign_state, submit_state, tabs
|
| 352 |
|
| 353 |
except Exception as e:
|
| 354 |
display_error_message(f"β Error saving response: {str(e)}")
|
|
|
|
| 400 |
choices=list(SCENARIOS.keys()),
|
| 401 |
value=None,
|
| 402 |
label="π Scenario",
|
| 403 |
+
# interactive=False,
|
| 404 |
)
|
| 405 |
scenario_content = gr.Textbox(
|
| 406 |
label="π Background",
|
|
|
|
| 524 |
# Button Function Setup
|
| 525 |
########################################################################################################
|
| 526 |
|
| 527 |
+
# participant.change(fn=set_user, inputs=[participant], outputs=[scenario])
|
| 528 |
+
participant.change(fn=set_user, inputs=[participant])
|
| 529 |
scenario.change(display_scenario,
|
| 530 |
inputs=[participant, scenario],
|
| 531 |
outputs=[scenario_content, prompt1, prompt2, images_method1, images_method2, like_image1, dislike_image1, like_image2, dislike_image2, history_images1, history_images2, example1.dataset, example2.dataset, next_btn1, next_btn2, redesign_btn1, redesign_btn2, submit_btn1, submit_btn2])
|
|
|
|
| 553 |
)
|
| 554 |
submit_btn1.click(fn=save_response,
|
| 555 |
inputs=[participant, scenario, prompt1, sim_radio1, like_radio1, dislike_radio1, active_tab],
|
| 556 |
+
outputs=[sim_radio1, dislike_radio1, like_radio1, prompt1, next_btn1, redesign_btn1, submit_btn1, tabs])
|
| 557 |
|
| 558 |
submit_btn2.click(fn=save_response,
|
| 559 |
inputs=[participant, scenario, prompt2, sim_radio2, like_radio2, dislike_radio2, active_tab],
|
| 560 |
+
outputs=[sim_radio2, dislike_radio2, like_radio2, prompt2, next_btn2, redesign_btn2, submit_btn2, tabs])
|
| 561 |
|
| 562 |
|
| 563 |
if __name__ == "__main__":
|