pufanyi commited on
Commit
086b308
1 Parent(s): ef47fd4

Refactor GET_DEFAULT_CHECKBOX function to remove commented out code and use choices for selected columns

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -87,7 +87,7 @@ def GET_DEFAULT_CHECKBOX(subset):
87
  return gr.CheckboxGroup(
88
  choices=choices,
89
  label="Select Columns to Display",
90
- # value=choices,
91
  )
92
 
93
 
@@ -136,7 +136,9 @@ def init_leaderboard(dataframes):
136
  filtered_data.sort_values(by="Total", ascending=False, inplace=True)
137
  # selected_columns.append("Model Name")
138
  if isinstance(selected_columns, CheckboxGroup):
139
- selected_columns = selected_columns.value
 
 
140
  print("Selected Columns:", selected_columns)
141
  selected_columns = [
142
  c for c in filtered_data.columns if c in selected_columns or c == "Model Name"
 
87
  return gr.CheckboxGroup(
88
  choices=choices,
89
  label="Select Columns to Display",
90
+ value=choices,
91
  )
92
 
93
 
 
136
  filtered_data.sort_values(by="Total", ascending=False, inplace=True)
137
  # selected_columns.append("Model Name")
138
  if isinstance(selected_columns, CheckboxGroup):
139
+ selected_columns = selected_columns.choices
140
+ if isinstance(selected_columns[0], tuple):
141
+ selected_columns = [c[1] for c in selected_columns]
142
  print("Selected Columns:", selected_columns)
143
  selected_columns = [
144
  c for c in filtered_data.columns if c in selected_columns or c == "Model Name"