5to9 commited on
Commit
a3d3acb
·
1 Parent(s): 5cec396

0.27 show labe on vote

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -180,6 +180,11 @@ def generate_both(system_prompt, input_text, chatbot_a, chatbot_b, max_new_token
180
  def clear():
181
  return [], []
182
 
 
 
 
 
 
183
  arena_notes = """## Important Notes:
184
  - Sometimes an error may occur when generating the response, in this case, please try again.
185
  """
@@ -200,13 +205,14 @@ with gr.Blocks() as demo:
200
  with gr.Column():
201
  chatbot_b = gr.Chatbot(label="Model B", show_copy_button=True, height=500)
202
  with gr.Row(variant="panel"):
203
- gr.Radio(["Bot A kicks ass!", "Bot B crushes it!"], label="Which bot performs better?", info="Rate the output"),
204
  with gr.Accordion(label="Generation Configurations", open=False):
205
  max_new_tokens = gr.Slider(minimum=128, maximum=4096, value=2048, label="Max New Tokens", step=128)
206
  temperature = gr.Slider(minimum=0.0, maximum=1.0, value=0.7, label="Temperature", step=0.01)
207
  top_p = gr.Slider(minimum=0.0, maximum=1.0, value=1.0, label="Top-p", step=0.01)
208
  repetition_penalty = gr.Slider(minimum=0.1, maximum=2.0, value=1.1, label="Repetition Penalty", step=0.1)
209
 
 
210
  input_text.submit(generate_both, inputs=[system_prompt, input_text, chatbot_a, chatbot_b, max_new_tokens, temperature, top_p, repetition_penalty], outputs=[chatbot_a, chatbot_b])
211
  submit_btn.click(generate_both, inputs=[system_prompt, input_text, chatbot_a, chatbot_b, max_new_tokens, temperature, top_p, repetition_penalty], outputs=[chatbot_a, chatbot_b])
212
  clear_btn.click(clear, outputs=[chatbot_a, chatbot_b])
 
180
  def clear():
181
  return [], []
182
 
183
+ def show_bot():
184
+ chatbot_a = "Hello A"
185
+ chatbot_b = "Hello B"
186
+ return gr.update(label=chatbot_a), gr.update(label=chatbot_b)
187
+
188
  arena_notes = """## Important Notes:
189
  - Sometimes an error may occur when generating the response, in this case, please try again.
190
  """
 
205
  with gr.Column():
206
  chatbot_b = gr.Chatbot(label="Model B", show_copy_button=True, height=500)
207
  with gr.Row(variant="panel"):
208
+ better_bot = gr.Radio(["Bot A kicks ass!", "Bot B crushes it!", "It's a draw."], label="Rate the output!"),
209
  with gr.Accordion(label="Generation Configurations", open=False):
210
  max_new_tokens = gr.Slider(minimum=128, maximum=4096, value=2048, label="Max New Tokens", step=128)
211
  temperature = gr.Slider(minimum=0.0, maximum=1.0, value=0.7, label="Temperature", step=0.01)
212
  top_p = gr.Slider(minimum=0.0, maximum=1.0, value=1.0, label="Top-p", step=0.01)
213
  repetition_penalty = gr.Slider(minimum=0.1, maximum=2.0, value=1.1, label="Repetition Penalty", step=0.1)
214
 
215
+ better_bot.select(outputs=[chatbot_a, chatbot_b])
216
  input_text.submit(generate_both, inputs=[system_prompt, input_text, chatbot_a, chatbot_b, max_new_tokens, temperature, top_p, repetition_penalty], outputs=[chatbot_a, chatbot_b])
217
  submit_btn.click(generate_both, inputs=[system_prompt, input_text, chatbot_a, chatbot_b, max_new_tokens, temperature, top_p, repetition_penalty], outputs=[chatbot_a, chatbot_b])
218
  clear_btn.click(clear, outputs=[chatbot_a, chatbot_b])