pufanyi commited on
Commit
ed61750
1 Parent(s): 6ec681c

Refactor init_leaderboard function to sort selected data by "Total" column in descending order

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -104,6 +104,7 @@ def init_leaderboard(dataframes):
104
  filtered_data = dataframes[subset][dataframes[subset]['Model Name'].str.contains(search_term, case=False)]
105
  selected_columns = [c.name for c in fields(AutoEvalColumn) if c.name in selected_columns]
106
  selected_data = filtered_data[selected_columns]
 
107
  return gr.DataFrame(selected_data, type="pandas", datatype=[c.type for c in fields(AutoEvalColumn) if c.name in selected_columns])
108
 
109
  with gr.Row():
 
104
  filtered_data = dataframes[subset][dataframes[subset]['Model Name'].str.contains(search_term, case=False)]
105
  selected_columns = [c.name for c in fields(AutoEvalColumn) if c.name in selected_columns]
106
  selected_data = filtered_data[selected_columns]
107
+ selected_data.sort_values(by="Total", ascending=False, inplace=True)
108
  return gr.DataFrame(selected_data, type="pandas", datatype=[c.type for c in fields(AutoEvalColumn) if c.name in selected_columns])
109
 
110
  with gr.Row():