Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update
Browse files
app.py
CHANGED
|
@@ -158,13 +158,13 @@ def select_columns(df: pd.DataFrame, columns: list[str]) -> pd.DataFrame:
|
|
| 158 |
AutoEvalColumn.model.name, # 'Model'
|
| 159 |
]
|
| 160 |
|
| 161 |
-
# 'always_here_cols'
|
| 162 |
columns = [c for c in columns if c not in always_here_cols]
|
| 163 |
new_columns = (
|
| 164 |
always_here_cols + [c for c in COLS if c in df.columns and c in columns] + [AutoEvalColumn.row_id.name]
|
| 165 |
)
|
| 166 |
|
| 167 |
-
#
|
| 168 |
seen = set()
|
| 169 |
unique_columns = []
|
| 170 |
for c in new_columns:
|
|
@@ -172,7 +172,7 @@ def select_columns(df: pd.DataFrame, columns: list[str]) -> pd.DataFrame:
|
|
| 172 |
unique_columns.append(c)
|
| 173 |
seen.add(c)
|
| 174 |
|
| 175 |
-
#
|
| 176 |
filtered_df = df[unique_columns]
|
| 177 |
return filtered_df
|
| 178 |
|
|
@@ -246,15 +246,15 @@ leaderboard_df = select_columns(leaderboard_df, INITIAL_COLUMNS)
|
|
| 246 |
|
| 247 |
|
| 248 |
def toggle_all_categories(action: str) -> list[gr.CheckboxGroup]:
|
| 249 |
-
"""
|
| 250 |
results = []
|
| 251 |
for task_type in TaskType:
|
| 252 |
if task_type == TaskType.NotTask:
|
| 253 |
-
# Model details
|
| 254 |
results.append(gr.CheckboxGroup())
|
| 255 |
else:
|
| 256 |
if action == "all":
|
| 257 |
-
#
|
| 258 |
results.append(
|
| 259 |
gr.CheckboxGroup(
|
| 260 |
value=[
|
|
@@ -265,10 +265,10 @@ def toggle_all_categories(action: str) -> list[gr.CheckboxGroup]:
|
|
| 265 |
)
|
| 266 |
)
|
| 267 |
elif action == "none":
|
| 268 |
-
#
|
| 269 |
results.append(gr.CheckboxGroup(value=[]))
|
| 270 |
elif action == "avg_only":
|
| 271 |
-
# AVG
|
| 272 |
results.append(
|
| 273 |
gr.CheckboxGroup(
|
| 274 |
value=[
|
|
|
|
| 158 |
AutoEvalColumn.model.name, # 'Model'
|
| 159 |
]
|
| 160 |
|
| 161 |
+
# Remove 'always_here_cols' from 'columns' to avoid duplicates
|
| 162 |
columns = [c for c in columns if c not in always_here_cols]
|
| 163 |
new_columns = (
|
| 164 |
always_here_cols + [c for c in COLS if c in df.columns and c in columns] + [AutoEvalColumn.row_id.name]
|
| 165 |
)
|
| 166 |
|
| 167 |
+
# Maintain order while removing duplicates
|
| 168 |
seen = set()
|
| 169 |
unique_columns = []
|
| 170 |
for c in new_columns:
|
|
|
|
| 172 |
unique_columns.append(c)
|
| 173 |
seen.add(c)
|
| 174 |
|
| 175 |
+
# Create DataFrame with filtered columns
|
| 176 |
filtered_df = df[unique_columns]
|
| 177 |
return filtered_df
|
| 178 |
|
|
|
|
| 246 |
|
| 247 |
|
| 248 |
def toggle_all_categories(action: str) -> list[gr.CheckboxGroup]:
|
| 249 |
+
"""Function to control all category checkboxes at once"""
|
| 250 |
results = []
|
| 251 |
for task_type in TaskType:
|
| 252 |
if task_type == TaskType.NotTask:
|
| 253 |
+
# Maintain existing selection for Model details
|
| 254 |
results.append(gr.CheckboxGroup())
|
| 255 |
else:
|
| 256 |
if action == "all":
|
| 257 |
+
# Select all
|
| 258 |
results.append(
|
| 259 |
gr.CheckboxGroup(
|
| 260 |
value=[
|
|
|
|
| 265 |
)
|
| 266 |
)
|
| 267 |
elif action == "none":
|
| 268 |
+
# Deselect all
|
| 269 |
results.append(gr.CheckboxGroup(value=[]))
|
| 270 |
elif action == "avg_only":
|
| 271 |
+
# Select only AVG metrics
|
| 272 |
results.append(
|
| 273 |
gr.CheckboxGroup(
|
| 274 |
value=[
|