pufanyi commited on
Commit
5270ff5
·
1 Parent(s): b401537

Refactor GET_DEFAULT_CHECKBOX function to remove "Model Name" column and handle exceptions in app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -114,14 +114,15 @@ def init_leaderboard(dataframes):
114
  default_columns = list(LEADERBOARD_DF[subset].columns)
115
  # default_columns.remove("Model Name")
116
 
117
- return update_data(subset, None, default_columns), GET_DEFAULT_TEXTBOX(), GET_DEFAULT_CHECKBOX(subset)
 
118
 
119
- def update_data(subset, search_term, selected_columns):
120
  global old_version
121
  print("Subset:", subset)
122
  print("Search Term:", search_term)
123
  print("Selected Columns:", selected_columns)
124
- if old_version != subset:
125
  search_term = None
126
  selected_columns = GET_DEFAULT_CHECKBOX(subset)
127
  bak_selected_columns = copy.deepcopy(selected_columns)
 
114
  default_columns = list(LEADERBOARD_DF[subset].columns)
115
  # default_columns.remove("Model Name")
116
 
117
+ # return update_data(subset, None, default_columns), GET_DEFAULT_TEXTBOX(), GET_DEFAULT_CHECKBOX(subset)
118
+ return update_data(subset, None, default_columns, force_refresh=True)
119
 
120
+ def update_data(subset, search_term, selected_columns, force_refresh=False):
121
  global old_version
122
  print("Subset:", subset)
123
  print("Search Term:", search_term)
124
  print("Selected Columns:", selected_columns)
125
+ if old_version != subset or force_refresh:
126
  search_term = None
127
  selected_columns = GET_DEFAULT_CHECKBOX(subset)
128
  bak_selected_columns = copy.deepcopy(selected_columns)