Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,6 +86,20 @@ def generate_responses(prompt):
|
|
| 86 |
def battle_arena(prompt):
|
| 87 |
response_a, response_b, model_a, model_b = generate_responses(prompt)
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
nickname_a = random.choice(arena_config.model_nicknames)
|
| 90 |
nickname_b = random.choice(arena_config.model_nicknames)
|
| 91 |
|
|
@@ -377,7 +391,11 @@ with gr.Blocks(css="""
|
|
| 377 |
gr.Markdown(arena_config.ARENA_NAME)
|
| 378 |
gr.Markdown(arena_config.ARENA_DESCRIPTION)
|
| 379 |
|
| 380 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 381 |
with gr.Tab("Battle Arena"):
|
| 382 |
with gr.Row():
|
| 383 |
prompt_input = gr.Textbox(
|
|
@@ -417,10 +435,6 @@ with gr.Blocks(css="""
|
|
| 417 |
|
| 418 |
new_battle_btn = gr.Button("New Battle")
|
| 419 |
|
| 420 |
-
# Leaderboard Tab
|
| 421 |
-
with gr.Tab("Leaderboard"):
|
| 422 |
-
leaderboard = gr.HTML(label="Leaderboard")
|
| 423 |
-
|
| 424 |
# Performance Chart Tab
|
| 425 |
with gr.Tab("Performance Chart"):
|
| 426 |
leaderboard_chart = gr.Plot(label="Model Performance Chart")
|
|
@@ -487,4 +501,3 @@ if __name__ == "__main__":
|
|
| 487 |
# Initialize ELO ratings before launching the app
|
| 488 |
ensure_elo_ratings_initialized()
|
| 489 |
demo.launch(show_api=False)
|
| 490 |
-
|
|
|
|
| 86 |
def battle_arena(prompt):
|
| 87 |
response_a, response_b, model_a, model_b = generate_responses(prompt)
|
| 88 |
|
| 89 |
+
# Check for API errors in responses
|
| 90 |
+
if "Error: Unable to get response from the model" in response_a or "Error: Unable to get response from the model" in response_b:
|
| 91 |
+
return (
|
| 92 |
+
[], [], None, None,
|
| 93 |
+
gr.update(value=[]),
|
| 94 |
+
gr.update(value=[]),
|
| 95 |
+
gr.update(interactive=False, value="Voting Disabled - API Error"),
|
| 96 |
+
gr.update(interactive=False, value="Voting Disabled - API Error"),
|
| 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)
|
| 104 |
nickname_b = random.choice(arena_config.model_nicknames)
|
| 105 |
|
|
|
|
| 391 |
gr.Markdown(arena_config.ARENA_NAME)
|
| 392 |
gr.Markdown(arena_config.ARENA_DESCRIPTION)
|
| 393 |
|
| 394 |
+
# Leaderboard Tab (now first)
|
| 395 |
+
with gr.Tab("Leaderboard"):
|
| 396 |
+
leaderboard = gr.HTML(label="Leaderboard")
|
| 397 |
+
|
| 398 |
+
# Battle Arena Tab (now second)
|
| 399 |
with gr.Tab("Battle Arena"):
|
| 400 |
with gr.Row():
|
| 401 |
prompt_input = gr.Textbox(
|
|
|
|
| 435 |
|
| 436 |
new_battle_btn = gr.Button("New Battle")
|
| 437 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
# Performance Chart Tab
|
| 439 |
with gr.Tab("Performance Chart"):
|
| 440 |
leaderboard_chart = gr.Plot(label="Model Performance Chart")
|
|
|
|
| 501 |
# Initialize ELO ratings before launching the app
|
| 502 |
ensure_elo_ratings_initialized()
|
| 503 |
demo.launch(show_api=False)
|
|
|