Spaces:
Running
Running
change default sorting
Browse files
app.py
CHANGED
|
@@ -22,6 +22,14 @@ def get_leaderboard():
|
|
| 22 |
if len(full_df) == 0:
|
| 23 |
return pd.DataFrame({'date':[], 'model':[], 'score':[], 'verified':[]})
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
return full_df
|
| 26 |
|
| 27 |
def format_dataframe(df, show_percentage=False, selected_groups=None, compact_view=True):
|
|
@@ -281,11 +289,12 @@ Generative machine learning models hold great promise for accelerating materials
|
|
| 281 |
with gr.Column(scale=1):
|
| 282 |
# Create choices with display names, but values are the raw column names
|
| 283 |
sort_choices = ["None"] + [COLUMN_DISPLAY_NAMES.get(col, col) for col in COLUMN_DISPLAY_NAMES.keys()]
|
|
|
|
| 284 |
sort_by = gr.Dropdown(
|
| 285 |
choices=sort_choices,
|
| 286 |
value="None",
|
| 287 |
label="Sort By",
|
| 288 |
-
info="Select column to sort by"
|
| 289 |
)
|
| 290 |
sort_direction = gr.Radio(
|
| 291 |
choices=["Ascending", "Descending"],
|
|
|
|
| 22 |
if len(full_df) == 0:
|
| 23 |
return pd.DataFrame({'date':[], 'model':[], 'score':[], 'verified':[]})
|
| 24 |
|
| 25 |
+
# Add computed column for MSUN+SUN
|
| 26 |
+
if 'msun_count' in full_df.columns and 'sun_count' in full_df.columns:
|
| 27 |
+
full_df['msun_plus_sun'] = full_df['msun_count'] + full_df['sun_count']
|
| 28 |
+
|
| 29 |
+
# Sort by MSUN+SUN in descending order by default
|
| 30 |
+
if 'msun_plus_sun' in full_df.columns:
|
| 31 |
+
full_df = full_df.sort_values(by='msun_plus_sun', ascending=False)
|
| 32 |
+
|
| 33 |
return full_df
|
| 34 |
|
| 35 |
def format_dataframe(df, show_percentage=False, selected_groups=None, compact_view=True):
|
|
|
|
| 289 |
with gr.Column(scale=1):
|
| 290 |
# Create choices with display names, but values are the raw column names
|
| 291 |
sort_choices = ["None"] + [COLUMN_DISPLAY_NAMES.get(col, col) for col in COLUMN_DISPLAY_NAMES.keys()]
|
| 292 |
+
# Note: The initial sort is already applied in get_leaderboard() by MSUN+SUN
|
| 293 |
sort_by = gr.Dropdown(
|
| 294 |
choices=sort_choices,
|
| 295 |
value="None",
|
| 296 |
label="Sort By",
|
| 297 |
+
info="Select column to sort by (default: sorted by MSUN+SUN descending)"
|
| 298 |
)
|
| 299 |
sort_direction = gr.Radio(
|
| 300 |
choices=["Ascending", "Descending"],
|