sh1gechan commited on
Commit
f5632f5
·
verified ·
1 Parent(s): decd89e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -444,34 +444,32 @@ with gr.Blocks() as demo_leaderboard:
444
 
445
  def toggle_all_categories(action: str, shown_columns_dict: dict):
446
  """全カテゴリーのチェックボックスを一括制御する関数"""
447
- results = {}
448
  for task_type in TaskType:
449
  if task_type == TaskType.NotTask:
450
  continue
451
 
452
- columns = [
453
- c.name
454
- for c in fields(AutoEvalColumn)
455
- if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
456
- ]
457
-
458
  if action == "all":
459
- results[task_type.name] = columns
 
 
 
 
 
460
  elif action == "none":
461
- results[task_type.name] = []
 
462
  elif action == "avg_only":
463
- results[task_type.name] = [
 
464
  c.name
465
  for c in fields(AutoEvalColumn)
466
  if not c.hidden and not c.never_hidden
467
  and c.task_type == task_type
468
  and (
469
- (task_type == TaskType.AVG) or # AVGカテゴリの場合は全て
470
- (task_type != TaskType.AVG and c.average) # その他のカテゴリはAVGのみ
471
  )
472
  ]
473
-
474
- return [results[task_type.name] for task_type in TaskType if task_type != TaskType.NotTask]
475
 
476
  # Submission demo
477
 
 
444
 
445
  def toggle_all_categories(action: str, shown_columns_dict: dict):
446
  """全カテゴリーのチェックボックスを一括制御する関数"""
 
447
  for task_type in TaskType:
448
  if task_type == TaskType.NotTask:
449
  continue
450
 
 
 
 
 
 
 
451
  if action == "all":
452
+ # 全選択: そのカテゴリーの全ての選択肢を返す
453
+ yield [
454
+ c.name
455
+ for c in fields(AutoEvalColumn)
456
+ if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
457
+ ]
458
  elif action == "none":
459
+ # 全解除: 空のリストを返す
460
+ yield []
461
  elif action == "avg_only":
462
+ # AVGのみ: AVGに関連する選択肢のみを返す
463
+ yield [
464
  c.name
465
  for c in fields(AutoEvalColumn)
466
  if not c.hidden and not c.never_hidden
467
  and c.task_type == task_type
468
  and (
469
+ (task_type == TaskType.AVG) or
470
+ (task_type != TaskType.AVG and c.average)
471
  )
472
  ]
 
 
473
 
474
  # Submission demo
475