hysts HF staff commited on
Commit
0b1a880
1 Parent(s): 47d0320
Files changed (1) hide show
  1. app.py +45 -45
app.py CHANGED
@@ -232,6 +232,51 @@ 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
  # Prepare the dataframes
236
 
237
  original_df = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
@@ -445,51 +490,6 @@ with gr.Blocks() as demo_leaderboard:
445
  demo_leaderboard.load(fn=load_query, outputs=[search_bar, hidden_search_bar])
446
 
447
 
448
- def toggle_all_categories(action: str, shown_columns_dict: dict):
449
- """全カテゴリーのチェックボックスを一括制御する関数"""
450
- results = []
451
- for task_type in TaskType:
452
- if task_type == TaskType.NotTask:
453
- # Model detailsの場合は既存の選択状態を維持
454
- results.append(
455
- [
456
- c.name
457
- for c in fields(AutoEvalColumn)
458
- if not c.hidden
459
- and not c.never_hidden
460
- and not c.dummy
461
- and c.task_type == task_type
462
- and c.displayed_by_default # デフォルトの表示状態を維持
463
- ]
464
- )
465
- else:
466
- if action == "all":
467
- # 全選択
468
- results.append(
469
- [
470
- c.name
471
- for c in fields(AutoEvalColumn)
472
- if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
473
- ]
474
- )
475
- elif action == "none":
476
- # 全解除
477
- results.append([])
478
- elif action == "avg_only":
479
- # AVGのみ
480
- results.append(
481
- [
482
- c.name
483
- for c in fields(AutoEvalColumn)
484
- if not c.hidden
485
- and not c.never_hidden
486
- and c.task_type == task_type
487
- and ((task_type == TaskType.AVG) or (task_type != TaskType.AVG and c.average))
488
- ]
489
- )
490
- return results
491
-
492
-
493
  # Submission demo
494
 
495
  with gr.Blocks() as demo_submission:
 
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, shown_columns_dict: dict):
236
+ """全カテゴリーのチェックボックスを一括制御する関数"""
237
+ results = []
238
+ for task_type in TaskType:
239
+ if task_type == TaskType.NotTask:
240
+ # Model detailsの場合は既存の選択状態を維持
241
+ results.append(
242
+ [
243
+ c.name
244
+ for c in fields(AutoEvalColumn)
245
+ if not c.hidden
246
+ and not c.never_hidden
247
+ and not c.dummy
248
+ and c.task_type == task_type
249
+ and c.displayed_by_default # デフォルトの表示状態を維持
250
+ ]
251
+ )
252
+ else:
253
+ if action == "all":
254
+ # 全選択
255
+ results.append(
256
+ [
257
+ c.name
258
+ for c in fields(AutoEvalColumn)
259
+ if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
260
+ ]
261
+ )
262
+ elif action == "none":
263
+ # 全解除
264
+ results.append([])
265
+ elif action == "avg_only":
266
+ # AVGのみ
267
+ results.append(
268
+ [
269
+ c.name
270
+ for c in fields(AutoEvalColumn)
271
+ if not c.hidden
272
+ and not c.never_hidden
273
+ and c.task_type == task_type
274
+ and ((task_type == TaskType.AVG) or (task_type != TaskType.AVG and c.average))
275
+ ]
276
+ )
277
+ return results
278
+
279
+
280
  # Prepare the dataframes
281
 
282
  original_df = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
 
490
  demo_leaderboard.load(fn=load_query, outputs=[search_bar, hidden_search_bar])
491
 
492
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
493
  # Submission demo
494
 
495
  with gr.Blocks() as demo_submission: