Spaces:
Runtime error
Runtime error
kz209
commited on
Commit
·
96b2814
1
Parent(s):
07b83f1
update
Browse files- pages/arena.py +6 -4
pages/arena.py
CHANGED
|
@@ -16,6 +16,8 @@ def random_data_selection():
|
|
| 16 |
|
| 17 |
# Function to handle user selection and disable the radio
|
| 18 |
def lock_selection(selected_option):
|
|
|
|
|
|
|
| 19 |
return gr.update(visible=True), selected_option, gr.update(interactive=False), gr.update(interactive=False)
|
| 20 |
|
| 21 |
def create_arena():
|
|
@@ -71,14 +73,14 @@ Once the streaming is complete, you can choose the best response.\u2764\ufe0f"""
|
|
| 71 |
|
| 72 |
submit_button.click(fn=lock_selection, inputs=choice, outputs=[output, output, choice, submit_button])
|
| 73 |
|
| 74 |
-
if
|
| 75 |
prompt_id = random_selected_prompts[0]
|
| 76 |
-
elif
|
| 77 |
prompt_id = random_selected_prompts[1]
|
| 78 |
-
elif
|
| 79 |
prompt_id = random_selected_prompts[2]
|
| 80 |
else:
|
| 81 |
-
raise ValueError(f"No corresponding response of {
|
| 82 |
|
| 83 |
for i in range(len(prompts)):
|
| 84 |
if prompts[i]['id'] == prompt_id:
|
|
|
|
| 16 |
|
| 17 |
# Function to handle user selection and disable the radio
|
| 18 |
def lock_selection(selected_option):
|
| 19 |
+
global global_selected_choice
|
| 20 |
+
global_selected_choice = selected_option # Store the selected choice in the variable
|
| 21 |
return gr.update(visible=True), selected_option, gr.update(interactive=False), gr.update(interactive=False)
|
| 22 |
|
| 23 |
def create_arena():
|
|
|
|
| 73 |
|
| 74 |
submit_button.click(fn=lock_selection, inputs=choice, outputs=[output, output, choice, submit_button])
|
| 75 |
|
| 76 |
+
if global_selected_choice == "Response 1":
|
| 77 |
prompt_id = random_selected_prompts[0]
|
| 78 |
+
elif global_selected_choice == "Response 2":
|
| 79 |
prompt_id = random_selected_prompts[1]
|
| 80 |
+
elif global_selected_choice == "Response 3":
|
| 81 |
prompt_id = random_selected_prompts[2]
|
| 82 |
else:
|
| 83 |
+
raise ValueError(f"No corresponding response of {global_selected_choice}")
|
| 84 |
|
| 85 |
for i in range(len(prompts)):
|
| 86 |
if prompts[i]['id'] == prompt_id:
|