pufanyi commited on
Commit
ed4dea2
β€’
1 Parent(s): 803f7d2

Refactor init_leaderboard function to update data outputs to dataframe and improve dropdown UI

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -94,8 +94,14 @@ def init_leaderboard(dataframes):
94
  global LEADERBOARD_DF
95
  LEADERBOARD_DF = get_leaderboard_df(RESULTS_REPO)
96
  default_columns = [c.name for c in fields(AutoEvalColumn) if c.displayed_by_default]
 
 
 
 
 
 
97
 
98
- return update_data(subset, None, default_columns), gr.Textbox("", placeholder="πŸ” Search Models... [press enter]", label="Filter Models by Name"), gr.CheckboxGroup(default_columns)
99
 
100
  def update_data(subset, search_term, selected_columns):
101
  print("Subset:", subset)
 
94
  global LEADERBOARD_DF
95
  LEADERBOARD_DF = get_leaderboard_df(RESULTS_REPO)
96
  default_columns = [c.name for c in fields(AutoEvalColumn) if c.displayed_by_default]
97
+ default_textbox = gr.Textbox("", placeholder="πŸ” Search Models... [press enter]", label="Filter Models by Name")
98
+ default_checkbox = gr.CheckboxGroup(
99
+ choices=[c.name for c in fields(AutoEvalColumn) if not c.hidden],
100
+ label="Select Columns to Display",
101
+ value=[c.name for c in fields(AutoEvalColumn) if c.displayed_by_default],
102
+ )
103
 
104
+ return update_data(subset, None, default_columns), default_textbox, default_checkbox
105
 
106
  def update_data(subset, search_term, selected_columns):
107
  print("Subset:", subset)