hysts HF staff commited on
Commit
2bc7f4f
·
1 Parent(s): e9ff778
Files changed (1) hide show
  1. app.py +8 -8
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' 'columns' から除外して重複を避ける
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=[