kz209 commited on
Commit
3f9babb
·
1 Parent(s): c0a9946
Files changed (1) hide show
  1. pages/arena.py +8 -5
pages/arena.py CHANGED
@@ -14,6 +14,10 @@ def random_data_selection():
14
 
15
  return datapoint
16
 
 
 
 
 
17
  def create_arena():
18
  with open("prompt/prompt.json", "r") as file:
19
  json_data = file.read()
@@ -62,11 +66,10 @@ Once the streaming is complete, you can choose the best response.\u2764\ufe0f"""
62
 
63
  submit_button = gr.Button("Submit")
64
 
65
- submit_button.click(
66
- #fn=lambda response1, response2, response3, choice: save_to_db(eval(choice.lower())),
67
- inputs=[choice],
68
- outputs=f"Response '{choice}' saved successfully!"
69
- )
70
 
71
  return demo
72
 
 
14
 
15
  return datapoint
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():
22
  with open("prompt/prompt.json", "r") as file:
23
  json_data = file.read()
 
66
 
67
  submit_button = gr.Button("Submit")
68
 
69
+ # Output to display the selected option
70
+ output = gr.Textbox(label="You selected:", visible=False)
71
+
72
+ submit_button.click(fn=lock_selection, inputs=choice, outputs=[output, output, choice, submit_button])
 
73
 
74
  return demo
75