pufanyi commited on
Commit
e7b07cd
·
1 Parent(s): f71c197

Refactor GET_DEFAULT_CHECKBOX function to accept a subset parameter

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -78,8 +78,8 @@ def GET_DEFAULT_TEXTBOX():
78
  return gr.Textbox("", placeholder="🔍 Search Models... [press enter]", label="Filter Models by Name")
79
 
80
 
81
- def GET_DEFAULT_CHECKBOX():
82
- choices = list(LEADERBOARD_DF.columns)
83
  choices.remove("Model Name")
84
  # print("Choices:", [c.name for c in fields(AutoEvalColumn) if not c.hidden])
85
  return gr.CheckboxGroup(
@@ -95,7 +95,7 @@ def init_leaderboard(dataframes):
95
  with gr.Row():
96
  selected_subset = gr.Dropdown(choices=subsets, label="Select Dataset Subset", value=NEWEST_VERSION)
97
  research_textbox = GET_DEFAULT_TEXTBOX()
98
- selected_columns = GET_DEFAULT_CHECKBOX()
99
 
100
  data = dataframes[NEWEST_VERSION]
101
 
@@ -107,10 +107,10 @@ def init_leaderboard(dataframes):
107
  global LEADERBOARD_DF
108
  LEADERBOARD_DF = get_leaderboard_df(RESULTS_REPO)
109
  # default_columns = [c.name for c in fields(AutoEvalColumn) if c.displayed_by_default]
110
- default_columns = list(LEADERBOARD_DF.columns)
111
  default_columns.remove("Model Name")
112
 
113
- return update_data(subset, None, default_columns), GET_DEFAULT_TEXTBOX(), GET_DEFAULT_CHECKBOX()
114
 
115
  def update_data(subset, search_term, selected_columns):
116
  print("Subset:", subset)
 
78
  return gr.Textbox("", placeholder="🔍 Search Models... [press enter]", label="Filter Models by Name")
79
 
80
 
81
+ def GET_DEFAULT_CHECKBOX(subset):
82
+ choices = list(LEADERBOARD_DF[subset].columns)
83
  choices.remove("Model Name")
84
  # print("Choices:", [c.name for c in fields(AutoEvalColumn) if not c.hidden])
85
  return gr.CheckboxGroup(
 
95
  with gr.Row():
96
  selected_subset = gr.Dropdown(choices=subsets, label="Select Dataset Subset", value=NEWEST_VERSION)
97
  research_textbox = GET_DEFAULT_TEXTBOX()
98
+ selected_columns = GET_DEFAULT_CHECKBOX(NEWEST_VERSION)
99
 
100
  data = dataframes[NEWEST_VERSION]
101
 
 
107
  global LEADERBOARD_DF
108
  LEADERBOARD_DF = get_leaderboard_df(RESULTS_REPO)
109
  # default_columns = [c.name for c in fields(AutoEvalColumn) if c.displayed_by_default]
110
+ default_columns = list(LEADERBOARD_DF[subset].columns)
111
  default_columns.remove("Model Name")
112
 
113
+ return update_data(subset, None, default_columns), GET_DEFAULT_TEXTBOX(), GET_DEFAULT_CHECKBOX(subset)
114
 
115
  def update_data(subset, search_term, selected_columns):
116
  print("Subset:", subset)