lcipolina commited on
Commit
920bbd1
·
verified ·
1 Parent(s): b29647b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -32,8 +32,8 @@ def extract_agent_info(filename: str):
32
  agent_type, model_name = parts[0], "Unknown"
33
  return agent_type, model_name
34
 
35
- def get_available_games() -> List[str]:
36
- """Extracts all unique game names from all SQLite databases and includes 'Aggregated Performance'."""
37
  db_files = find_or_download_db()
38
  game_names = set()
39
 
@@ -49,7 +49,8 @@ def get_available_games() -> List[str]:
49
  conn.close()
50
 
51
  game_list = sorted(game_names) if game_names else ["No Games Found"]
52
- game_list.insert(0, "Aggregated Performance") # Ensure 'Aggregated Performance' is always first
 
53
  return game_list
54
 
55
  def extract_leaderboard_stats(game_name: str) -> pd.DataFrame:
@@ -124,7 +125,7 @@ def extract_leaderboard_stats(game_name: str) -> pd.DataFrame:
124
  with gr.Blocks() as interface:
125
  with gr.Tab("Game Arena"):
126
  gr.Markdown("# Play Against LLMs\nChoose a game and an opponent to play!")
127
- game_dropdown = gr.Dropdown(get_available_games(), label="Select a Game")
128
  opponent_dropdown = gr.Dropdown(["Random Bot", "LLM"], label="Choose Opponent")
129
  play_button = gr.Button("Start Game")
130
  game_output = gr.Textbox(label="Game Log")
@@ -133,8 +134,7 @@ with gr.Blocks() as interface:
133
 
134
  with gr.Tab("Leaderboard"):
135
  gr.Markdown("# LLM Model Leaderboard\nTrack performance across different games!")
136
- available_games = get_available_games()
137
- leaderboard_game_dropdown = gr.Dropdown(available_games, label="Select Game", value="Aggregated Performance")
138
  leaderboard_table = gr.Dataframe(value=extract_leaderboard_stats("Aggregated Performance"), headers=["agent_name", "agent_type", "# games", "total rewards", "avg_generation_time (sec)", "win-rate", "win vs_random (%)"], every=5)
139
 
140
  interface.launch()
 
32
  agent_type, model_name = parts[0], "Unknown"
33
  return agent_type, model_name
34
 
35
+ def get_available_games(include_aggregated=True) -> List[str]:
36
+ """Extracts all unique game names from all SQLite databases. Includes 'Aggregated Performance' only when required."""
37
  db_files = find_or_download_db()
38
  game_names = set()
39
 
 
49
  conn.close()
50
 
51
  game_list = sorted(game_names) if game_names else ["No Games Found"]
52
+ if include_aggregated:
53
+ game_list.insert(0, "Aggregated Performance") # Ensure 'Aggregated Performance' is always first
54
  return game_list
55
 
56
  def extract_leaderboard_stats(game_name: str) -> pd.DataFrame:
 
125
  with gr.Blocks() as interface:
126
  with gr.Tab("Game Arena"):
127
  gr.Markdown("# Play Against LLMs\nChoose a game and an opponent to play!")
128
+ game_dropdown = gr.Dropdown(get_available_games(include_aggregated=False), label="Select a Game")
129
  opponent_dropdown = gr.Dropdown(["Random Bot", "LLM"], label="Choose Opponent")
130
  play_button = gr.Button("Start Game")
131
  game_output = gr.Textbox(label="Game Log")
 
134
 
135
  with gr.Tab("Leaderboard"):
136
  gr.Markdown("# LLM Model Leaderboard\nTrack performance across different games!")
137
+ leaderboard_game_dropdown = gr.Dropdown(get_available_games(), label="Select Game", value="Aggregated Performance")
 
138
  leaderboard_table = gr.Dataframe(value=extract_leaderboard_stats("Aggregated Performance"), headers=["agent_name", "agent_type", "# games", "total rewards", "avg_generation_time (sec)", "win-rate", "win vs_random (%)"], every=5)
139
 
140
  interface.launch()