t0-0 commited on
Commit
e4af1e5
1 Parent(s): 7fcd583

Wrap column filter and model filter with Accordion

Browse files
Files changed (1) hide show
  1. app.py +102 -100
app.py CHANGED
@@ -390,107 +390,109 @@ with gr.Blocks() as demo_leaderboard:
390
  show_label=False,
391
  elem_id="search-bar",
392
  )
393
- with gr.Row():
394
  with gr.Row():
395
- select_all_button = gr.Button(SELECT_ALL_BUTTON_LABEL_JA, size="sm")
396
- select_none_button = gr.Button(SELECT_NONE_BUTTON_LABEL_JA, size="sm")
397
- select_avg_only_button = gr.Button(SELECT_AVG_ONLY_BUTTON_LABEL_JA, size="sm")
398
-
399
- for task_type in TaskType:
400
- if task_type == TaskType.NotTask:
401
- label = "Model details"
402
- else:
403
- label = task_type.value
404
- with gr.Accordion(label, open=True, elem_classes="accordion"):
405
- with gr.Row(height=110):
406
- shown_column = gr.CheckboxGroup(
407
- show_label=False,
408
- choices=[
409
- c.name
410
- for c in fields(AutoEvalColumn)
411
- if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
412
- ],
413
- value=[
414
- c.name
415
- for c in fields(AutoEvalColumn)
416
- if c.displayed_by_default
417
- and not c.hidden
418
- and not c.never_hidden
419
- and c.task_type == task_type
420
- ],
421
- elem_id="column-select",
422
- container=False,
423
- )
424
- shown_columns_dict[task_type.name] = shown_column
425
- checkboxes.append(shown_column)
426
-
427
- # with gr.Row(height=110):
428
- # shown_column = gr.CheckboxGroup(
429
- # show_label=False,
430
- # choices=[
431
- # c.name
432
- # for c in fields(AutoEvalColumn)
433
- # if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
434
- # # and not c.average
435
- # # or (task_type == TaskType.AVG and c.average)
436
- # ],
437
- # value=[
438
- # c.name
439
- # for c in fields(AutoEvalColumn)
440
- # if c.displayed_by_default
441
- # and not c.hidden
442
- # and not c.never_hidden
443
- # and c.task_type == task_type
444
- # # and not c.average
445
- # # or (task_type == TaskType.AVG and c.average)
446
- # ],
447
- # elem_id="column-select",
448
- # container=False,
449
- # )
450
- # shown_columns_dict[task_type.name] = shown_column
451
- with gr.Row():
452
- filter_columns_type = gr.CheckboxGroup(
453
- label="Model types",
454
- choices=[t.to_str() for t in ModelType],
455
- value=[t.to_str() for t in ModelType],
456
- elem_id="filter-columns-type",
457
- )
458
- filter_columns_precision = gr.CheckboxGroup(
459
- label="Precision",
460
- choices=[i.value.name for i in Precision],
461
- value=[i.value.name for i in Precision],
462
- elem_id="filter-columns-precision",
463
- )
464
- filter_columns_size = gr.CheckboxGroup(
465
- label="Model sizes (in billions of parameters)",
466
- choices=list(NUMERIC_INTERVALS.keys()),
467
- value=list(NUMERIC_INTERVALS.keys()),
468
- elem_id="filter-columns-size",
469
- )
470
- filter_columns_add_special_tokens = gr.CheckboxGroup(
471
- label="Add Special Tokens",
472
- choices=[i.value.name for i in AddSpecialTokens],
473
- value=[i.value.name for i in AddSpecialTokens],
474
- elem_id="filter-columns-add-special-tokens",
475
- )
476
- filter_columns_num_few_shots = gr.CheckboxGroup(
477
- label="Num Few Shots",
478
- choices=[i.value.name for i in NumFewShots],
479
- value=[i.value.name for i in NumFewShots],
480
- elem_id="filter-columns-num-few-shots",
481
- )
482
- filter_columns_version = gr.CheckboxGroup(
483
- label="llm-jp-eval version",
484
- choices=[i.value.name for i in Version],
485
- value=[i.value.name for i in Version],
486
- elem_id="filter-columns-version",
487
- )
488
- # filter_columns_backend = gr.CheckboxGroup(
489
- # label="Backend Library",
490
- # choices=[i.value.name for i in Backend],
491
- # value=[i.value.name for i in Backend],
492
- # elem_id="filter-columns-backend",
493
- # )
 
 
494
 
495
  # DataFrameコンポーネントの初期化
496
  leaderboard_table = gr.Dataframe(
 
390
  show_label=False,
391
  elem_id="search-bar",
392
  )
393
+ with gr.Accordion("Column Filter", open=True):
394
  with gr.Row():
395
+ with gr.Row():
396
+ select_all_button = gr.Button(SELECT_ALL_BUTTON_LABEL_JA, size="sm")
397
+ select_none_button = gr.Button(SELECT_NONE_BUTTON_LABEL_JA, size="sm")
398
+ select_avg_only_button = gr.Button(SELECT_AVG_ONLY_BUTTON_LABEL_JA, size="sm")
399
+
400
+ for task_type in TaskType:
401
+ if task_type == TaskType.NotTask:
402
+ label = "Model details"
403
+ else:
404
+ label = task_type.value
405
+ with gr.Accordion(label, open=True, elem_classes="accordion"):
406
+ with gr.Row(height=110):
407
+ shown_column = gr.CheckboxGroup(
408
+ show_label=False,
409
+ choices=[
410
+ c.name
411
+ for c in fields(AutoEvalColumn)
412
+ if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
413
+ ],
414
+ value=[
415
+ c.name
416
+ for c in fields(AutoEvalColumn)
417
+ if c.displayed_by_default
418
+ and not c.hidden
419
+ and not c.never_hidden
420
+ and c.task_type == task_type
421
+ ],
422
+ elem_id="column-select",
423
+ container=False,
424
+ )
425
+ shown_columns_dict[task_type.name] = shown_column
426
+ checkboxes.append(shown_column)
427
+
428
+ # with gr.Row(height=110):
429
+ # shown_column = gr.CheckboxGroup(
430
+ # show_label=False,
431
+ # choices=[
432
+ # c.name
433
+ # for c in fields(AutoEvalColumn)
434
+ # if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
435
+ # # and not c.average
436
+ # # or (task_type == TaskType.AVG and c.average)
437
+ # ],
438
+ # value=[
439
+ # c.name
440
+ # for c in fields(AutoEvalColumn)
441
+ # if c.displayed_by_default
442
+ # and not c.hidden
443
+ # and not c.never_hidden
444
+ # and c.task_type == task_type
445
+ # # and not c.average
446
+ # # or (task_type == TaskType.AVG and c.average)
447
+ # ],
448
+ # elem_id="column-select",
449
+ # container=False,
450
+ # )
451
+ # shown_columns_dict[task_type.name] = shown_column
452
+ with gr.Accordion("Model Filter", open=True):
453
+ with gr.Row():
454
+ filter_columns_type = gr.CheckboxGroup(
455
+ label="Model types",
456
+ choices=[t.to_str() for t in ModelType],
457
+ value=[t.to_str() for t in ModelType],
458
+ elem_id="filter-columns-type",
459
+ )
460
+ filter_columns_precision = gr.CheckboxGroup(
461
+ label="Precision",
462
+ choices=[i.value.name for i in Precision],
463
+ value=[i.value.name for i in Precision],
464
+ elem_id="filter-columns-precision",
465
+ )
466
+ filter_columns_size = gr.CheckboxGroup(
467
+ label="Model sizes (in billions of parameters)",
468
+ choices=list(NUMERIC_INTERVALS.keys()),
469
+ value=list(NUMERIC_INTERVALS.keys()),
470
+ elem_id="filter-columns-size",
471
+ )
472
+ filter_columns_add_special_tokens = gr.CheckboxGroup(
473
+ label="Add Special Tokens",
474
+ choices=[i.value.name for i in AddSpecialTokens],
475
+ value=[i.value.name for i in AddSpecialTokens],
476
+ elem_id="filter-columns-add-special-tokens",
477
+ )
478
+ filter_columns_num_few_shots = gr.CheckboxGroup(
479
+ label="Num Few Shots",
480
+ choices=[i.value.name for i in NumFewShots],
481
+ value=[i.value.name for i in NumFewShots],
482
+ elem_id="filter-columns-num-few-shots",
483
+ )
484
+ filter_columns_version = gr.CheckboxGroup(
485
+ label="llm-jp-eval version",
486
+ choices=[i.value.name for i in Version],
487
+ value=[i.value.name for i in Version],
488
+ elem_id="filter-columns-version",
489
+ )
490
+ # filter_columns_backend = gr.CheckboxGroup(
491
+ # label="Backend Library",
492
+ # choices=[i.value.name for i in Backend],
493
+ # value=[i.value.name for i in Backend],
494
+ # elem_id="filter-columns-backend",
495
+ # )
496
 
497
  # DataFrameコンポーネントの初期化
498
  leaderboard_table = gr.Dataframe(