hysts HF staff commited on
Commit
8c936c3
·
1 Parent(s): 22103ee
Files changed (1) hide show
  1. app.py +39 -39
app.py CHANGED
@@ -232,45 +232,6 @@ def load_query(request: gr.Request): # triggered only once at startup => read q
232
  ) # return one for the "search_bar", one for a hidden component that triggers a reload only if value has changed
233
 
234
 
235
- def toggle_all_categories(action: str) -> list[gr.CheckboxGroup]:
236
- """全カテゴリーのチェックボックスを一括制御する関数"""
237
- results = []
238
- for task_type in TaskType:
239
- if task_type == TaskType.NotTask:
240
- # Model detailsの場合は既存の選択状態を維持
241
- results.append(gr.CheckboxGroup())
242
- else:
243
- if action == "all":
244
- # 全選択
245
- results.append(
246
- gr.CheckboxGroup(
247
- value=[
248
- c.name
249
- for c in fields(AutoEvalColumn)
250
- if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
251
- ]
252
- )
253
- )
254
- elif action == "none":
255
- # 全解除
256
- results.append(gr.CheckboxGroup(value=[]))
257
- elif action == "avg_only":
258
- # AVGのみ
259
- results.append(
260
- gr.CheckboxGroup(
261
- value=[
262
- c.name
263
- for c in fields(AutoEvalColumn)
264
- if not c.hidden
265
- and not c.never_hidden
266
- and c.task_type == task_type
267
- and ((task_type == TaskType.AVG) or (task_type != TaskType.AVG and c.average))
268
- ]
269
- )
270
- )
271
- return results
272
-
273
-
274
  # Prepare the dataframes
275
 
276
  original_df = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
@@ -314,6 +275,45 @@ leaderboard_df_filtered = select_columns(leaderboard_df, initial_columns)
314
  # Leaderboard demo
315
 
316
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  SELECT_ALL_BUTTON_LABEL = "Select All"
318
  SELECT_ALL_BUTTON_LABEL_JA = "全選択"
319
  SELECT_NONE_BUTTON_LABEL = "Select None"
 
232
  ) # return one for the "search_bar", one for a hidden component that triggers a reload only if value has changed
233
 
234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  # Prepare the dataframes
236
 
237
  original_df = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
 
275
  # Leaderboard demo
276
 
277
 
278
+ def toggle_all_categories(action: str) -> list[gr.CheckboxGroup]:
279
+ """全カテゴリーのチェックボックスを一括制御する関数"""
280
+ results = []
281
+ for task_type in TaskType:
282
+ if task_type == TaskType.NotTask:
283
+ # Model detailsの場合は既存の選択状態を維持
284
+ results.append(gr.CheckboxGroup())
285
+ else:
286
+ if action == "all":
287
+ # 全選択
288
+ results.append(
289
+ gr.CheckboxGroup(
290
+ value=[
291
+ c.name
292
+ for c in fields(AutoEvalColumn)
293
+ if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
294
+ ]
295
+ )
296
+ )
297
+ elif action == "none":
298
+ # 全解除
299
+ results.append(gr.CheckboxGroup(value=[]))
300
+ elif action == "avg_only":
301
+ # AVGのみ
302
+ results.append(
303
+ gr.CheckboxGroup(
304
+ value=[
305
+ c.name
306
+ for c in fields(AutoEvalColumn)
307
+ if not c.hidden
308
+ and not c.never_hidden
309
+ and c.task_type == task_type
310
+ and ((task_type == TaskType.AVG) or (task_type != TaskType.AVG and c.average))
311
+ ]
312
+ )
313
+ )
314
+ return results
315
+
316
+
317
  SELECT_ALL_BUTTON_LABEL = "Select All"
318
  SELECT_ALL_BUTTON_LABEL_JA = "全選択"
319
  SELECT_NONE_BUTTON_LABEL = "Select None"