pufanyi commited on
Commit
4215684
1 Parent(s): 3ad91d0

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

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -95,8 +95,9 @@ def init_leaderboard(dataframes):
95
  return update_data(subset, research_textbox, selected_columns)
96
 
97
  def update_data(subset, search_term, selected_columns):
98
- return gr.DataFrame(dataframes[subset][dataframes[subset].model.str.contains(search_term, case=False)][selected_columns], type="pandas", datatype=[c.type for c in fields(AutoEvalColumn)])
99
- # ])#datatype=[c.type for c in fields(AutoEvalColumn) if c.name in selected_columns])
 
100
 
101
  with gr.Row():
102
  refresh_button = gr.Button("Refresh")
 
95
  return update_data(subset, research_textbox, selected_columns)
96
 
97
  def update_data(subset, search_term, selected_columns):
98
+ filtered_data = dataframes[subset][dataframes[subset]['Model Name'].str.contains(search_term, case=False)]
99
+ selected_data = filtered_data[selected_columns]
100
+ return gr.DataFrame(selected_data, type="pandas", datatype=[c.type for c in fields(AutoEvalColumn) if c.name in selected_columns])
101
 
102
  with gr.Row():
103
  refresh_button = gr.Button("Refresh")