lcipolina commited on
Commit
d37d01f
·
verified ·
1 Parent(s): 772a7e3

Bringing back the 'update' button on the bottom

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -75,6 +75,7 @@ with gr.Blocks() as interface:
75
  leaderboard_table = gr.Dataframe(value=calculate_leaderboard(games_list[0]), label="Leaderboard")
76
  model_dropdown = gr.Dropdown(choices=llm_models, label="Select LLM Model")
77
  download_button = gr.File(label="Download Statistics File")
 
78
 
79
  def update_leaderboard(selected_game):
80
  """Updates the leaderboard table based on the selected game."""
@@ -84,7 +85,12 @@ with gr.Blocks() as interface:
84
  """Creates a downloadable JSON file with stats for the selected model."""
85
  return generate_stats_file(model_name)
86
 
 
 
 
 
87
  game_dropdown.change(fn=update_leaderboard, inputs=[game_dropdown], outputs=[leaderboard_table])
88
  model_dropdown.change(fn=provide_download_file, inputs=[model_dropdown], outputs=[download_button])
 
89
 
90
  interface.launch()
 
75
  leaderboard_table = gr.Dataframe(value=calculate_leaderboard(games_list[0]), label="Leaderboard")
76
  model_dropdown = gr.Dropdown(choices=llm_models, label="Select LLM Model")
77
  download_button = gr.File(label="Download Statistics File")
78
+ refresh_button = gr.Button("Refresh Leaderboard")
79
 
80
  def update_leaderboard(selected_game):
81
  """Updates the leaderboard table based on the selected game."""
 
85
  """Creates a downloadable JSON file with stats for the selected model."""
86
  return generate_stats_file(model_name)
87
 
88
+ def refresh_leaderboard():
89
+ """Manually refresh the leaderboard."""
90
+ return calculate_leaderboard(game_dropdown.value)
91
+
92
  game_dropdown.change(fn=update_leaderboard, inputs=[game_dropdown], outputs=[leaderboard_table])
93
  model_dropdown.change(fn=provide_download_file, inputs=[model_dropdown], outputs=[download_button])
94
+ refresh_button.click(fn=refresh_leaderboard, inputs=[], outputs=[leaderboard_table])
95
 
96
  interface.launch()