k-mktr commited on
Commit
8e6b559
Β·
verified Β·
1 Parent(s): acb363b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -10
app.py CHANGED
@@ -97,7 +97,8 @@ def battle_arena(prompt):
97
  gr.update(interactive=False, visible=False),
98
  prompt,
99
  0,
100
- gr.update(visible=False)
 
101
  )
102
 
103
  nickname_a = random.choice(arena_config.model_nicknames)
@@ -120,10 +121,11 @@ def battle_arena(prompt):
120
  gr.update(label=nickname_b, value=response_b_formatted),
121
  gr.update(interactive=True, value=f"Vote for {nickname_a}"),
122
  gr.update(interactive=True, value=f"Vote for {nickname_b}"),
123
- gr.update(interactive=True, visible=True), # Enable and show Tie button
124
- prompt, # Return the original prompt
125
- 0, # Initialize tie count
126
- gr.update(visible=False) # Hide model names row
 
127
  )
128
  else:
129
  return (
@@ -132,10 +134,11 @@ def battle_arena(prompt):
132
  gr.update(label=nickname_b, value=response_a_formatted),
133
  gr.update(interactive=True, value=f"Vote for {nickname_a}"),
134
  gr.update(interactive=True, value=f"Vote for {nickname_b}"),
135
- gr.update(interactive=True, visible=True), # Enable and show Tie button
136
- prompt, # Return the original prompt
137
- 0, # Initialize tie count
138
- gr.update(visible=False) # Hide model names row
 
139
  )
140
 
141
  def record_vote(prompt, left_response, right_response, left_model, right_model, choice):
@@ -424,7 +427,12 @@ with gr.Blocks(css="""
424
  tie_btn = gr.Button("Tie πŸ™ˆ Continue with a new prompt", interactive=False, visible=False)
425
  right_vote_btn = gr.Button(f"Vote for {right_output.label}", interactive=False)
426
 
427
- result = gr.Textbox(label="Result", interactive=False, visible=False)
 
 
 
 
 
428
 
429
  with gr.Row(visible=False) as model_names_row:
430
  left_model = gr.Textbox(label="πŸ”΅ Left Model", interactive=False)
 
97
  gr.update(interactive=False, visible=False),
98
  prompt,
99
  0,
100
+ gr.update(visible=False),
101
+ gr.update(value="Error: Unable to get response from the model", visible=True)
102
  )
103
 
104
  nickname_a = random.choice(arena_config.model_nicknames)
 
121
  gr.update(label=nickname_b, value=response_b_formatted),
122
  gr.update(interactive=True, value=f"Vote for {nickname_a}"),
123
  gr.update(interactive=True, value=f"Vote for {nickname_b}"),
124
+ gr.update(interactive=True, visible=True),
125
+ prompt,
126
+ 0,
127
+ gr.update(visible=False),
128
+ gr.update(value="Ready for your vote! πŸ—³οΈ", visible=True)
129
  )
130
  else:
131
  return (
 
134
  gr.update(label=nickname_b, value=response_a_formatted),
135
  gr.update(interactive=True, value=f"Vote for {nickname_a}"),
136
  gr.update(interactive=True, value=f"Vote for {nickname_b}"),
137
+ gr.update(interactive=True, visible=True),
138
+ prompt,
139
+ 0,
140
+ gr.update(visible=False),
141
+ gr.update(value="Ready for your vote! πŸ—³οΈ", visible=True)
142
  )
143
 
144
  def record_vote(prompt, left_response, right_response, left_model, right_model, choice):
 
427
  tie_btn = gr.Button("Tie πŸ™ˆ Continue with a new prompt", interactive=False, visible=False)
428
  right_vote_btn = gr.Button(f"Vote for {right_output.label}", interactive=False)
429
 
430
+ result = gr.Textbox(
431
+ label="Status",
432
+ interactive=False,
433
+ value="Generate responses to start the battle! πŸš€",
434
+ visible=True # Always visible
435
+ )
436
 
437
  with gr.Row(visible=False) as model_names_row:
438
  left_model = gr.Textbox(label="πŸ”΅ Left Model", interactive=False)