Spaces:
Running
Running
Refactor init_leaderboard function to sort selected data by "Total" column in descending order
Browse files
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():
|