t0-0 commited on
Commit
4eeb69c
1 Parent(s): f7010df

Prevent dummy data from being displayed

Browse files
Files changed (2) hide show
  1. app.py +88 -78
  2. style.css +0 -8
app.py CHANGED
@@ -163,9 +163,7 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
163
 
164
  # 'always_here_cols' を 'columns' から除外して重複を避ける
165
  columns = [c for c in columns if c not in always_here_cols]
166
- new_columns = (
167
- always_here_cols + [c for c in COLS if c in df.columns and c in columns] + [AutoEvalColumn.dummy.name]
168
- )
169
 
170
  # 重複を排除しつつ順序を維持
171
  seen = set()
@@ -286,65 +284,69 @@ with gr.Blocks() as demo_leaderboard:
286
  with gr.Row():
287
  shown_columns_dict = {}
288
  checkboxes = []
289
- with gr.Row():
290
- gr.Button("全選択", size="sm").click(fn=lambda: toggle_all_categories("all", shown_columns_dict), outputs=checkboxes)
291
- gr.Button("全解除", size="sm").click(fn=lambda: toggle_all_categories("none", shown_columns_dict), outputs=checkboxes)
292
- gr.Button("AVGのみ", size="sm").click(fn=lambda: toggle_all_categories("avg_only", shown_columns_dict), outputs=checkboxes)
293
-
 
 
 
 
 
 
294
  for task_type in TaskType:
295
  if task_type == TaskType.NotTask:
296
  label = "Model details"
297
  else:
298
  label = task_type.value
299
  with gr.Accordion(label, open=True, elem_classes="accordion"):
300
- with gr.Row(height=110):
301
- shown_column = gr.CheckboxGroup(
302
- show_label=False,
303
- choices=[
304
- c.name
305
- for c in fields(AutoEvalColumn)
306
- if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
307
- ],
308
- value=[
309
- c.name
310
- for c in fields(AutoEvalColumn)
311
- if not c.hidden and not c.never_hidden
312
- and c.task_type == task_type
313
- and (
314
- (task_type == TaskType.AVG) or
315
- (task_type != TaskType.AVG and c.average)
316
- )
317
- ],
318
- elem_id="column-select",
319
- container=False,
320
- )
321
- shown_columns_dict[task_type.name] = shown_column
322
- checkboxes.append(shown_column)
323
-
324
- # with gr.Row(height=110):
325
- # shown_column = gr.CheckboxGroup(
326
- # show_label=False,
327
- # choices=[
328
- # c.name
329
- # for c in fields(AutoEvalColumn)
330
- # if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
331
- # # and not c.average
332
- # # or (task_type == TaskType.AVG and c.average)
333
- # ],
334
- # value=[
335
- # c.name
336
- # for c in fields(AutoEvalColumn)
337
- # if c.displayed_by_default
338
- # and not c.hidden
339
- # and not c.never_hidden
340
- # and c.task_type == task_type
341
- # # and not c.average
342
- # # or (task_type == TaskType.AVG and c.average)
343
- # ],
344
- # elem_id="column-select",
345
- # container=False,
346
- # )
347
- # shown_columns_dict[task_type.name] = shown_column
348
  with gr.Row():
349
  filter_columns_type = gr.CheckboxGroup(
350
  label="Model types",
@@ -442,44 +444,52 @@ with gr.Blocks() as demo_leaderboard:
442
  # Check query parameter once at startup and update search bar + hidden component
443
  demo_leaderboard.load(fn=load_query, outputs=[search_bar, hidden_search_bar])
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
  # Model detailsの場合は既存の選択状態を維持
451
- results.append([
452
- c.name
453
- for c in fields(AutoEvalColumn)
454
- if not c.hidden and not c.never_hidden and not c.dummy
455
- and c.task_type == task_type
456
- and c.displayed_by_default # デフォルトの表示状態を維持
457
- ])
 
 
 
 
458
  else:
459
  if action == "all":
460
  # 全選択
461
- results.append([
462
- c.name
463
- for c in fields(AutoEvalColumn)
464
- if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
465
- ])
 
 
466
  elif action == "none":
467
  # 全解除
468
  results.append([])
469
  elif action == "avg_only":
470
  # AVGのみ
471
- results.append([
472
- c.name
473
- for c in fields(AutoEvalColumn)
474
- if not c.hidden and not c.never_hidden
475
- and c.task_type == task_type
476
- and (
477
- (task_type == TaskType.AVG) or
478
- (task_type != TaskType.AVG and c.average)
479
- )
480
- ])
481
  return results
482
 
 
483
  # Submission demo
484
 
485
  with gr.Blocks() as demo_submission:
 
163
 
164
  # 'always_here_cols' を 'columns' から除外して重複を避ける
165
  columns = [c for c in columns if c not in always_here_cols]
166
+ new_columns = always_here_cols + [c for c in COLS if c in df.columns and c in columns]
 
 
167
 
168
  # 重複を排除しつつ順序を維持
169
  seen = set()
 
284
  with gr.Row():
285
  shown_columns_dict = {}
286
  checkboxes = []
287
+ with gr.Row():
288
+ gr.Button("全選択", size="sm").click(
289
+ fn=lambda: toggle_all_categories("all", shown_columns_dict), outputs=checkboxes
290
+ )
291
+ gr.Button("全解除", size="sm").click(
292
+ fn=lambda: toggle_all_categories("none", shown_columns_dict), outputs=checkboxes
293
+ )
294
+ gr.Button("AVGのみ", size="sm").click(
295
+ fn=lambda: toggle_all_categories("avg_only", shown_columns_dict), outputs=checkboxes
296
+ )
297
+
298
  for task_type in TaskType:
299
  if task_type == TaskType.NotTask:
300
  label = "Model details"
301
  else:
302
  label = task_type.value
303
  with gr.Accordion(label, open=True, elem_classes="accordion"):
304
+ with gr.Row(height=110):
305
+ shown_column = gr.CheckboxGroup(
306
+ show_label=False,
307
+ choices=[
308
+ c.name
309
+ for c in fields(AutoEvalColumn)
310
+ if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
311
+ ],
312
+ value=[
313
+ c.name
314
+ for c in fields(AutoEvalColumn)
315
+ if not c.hidden
316
+ and not c.never_hidden
317
+ and c.task_type == task_type
318
+ and ((task_type == TaskType.AVG) or (task_type != TaskType.AVG and c.average))
319
+ ],
320
+ elem_id="column-select",
321
+ container=False,
322
+ )
323
+ shown_columns_dict[task_type.name] = shown_column
324
+ checkboxes.append(shown_column)
325
+
326
+ # with gr.Row(height=110):
327
+ # shown_column = gr.CheckboxGroup(
328
+ # show_label=False,
329
+ # choices=[
330
+ # c.name
331
+ # for c in fields(AutoEvalColumn)
332
+ # if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
333
+ # # and not c.average
334
+ # # or (task_type == TaskType.AVG and c.average)
335
+ # ],
336
+ # value=[
337
+ # c.name
338
+ # for c in fields(AutoEvalColumn)
339
+ # if c.displayed_by_default
340
+ # and not c.hidden
341
+ # and not c.never_hidden
342
+ # and c.task_type == task_type
343
+ # # and not c.average
344
+ # # or (task_type == TaskType.AVG and c.average)
345
+ # ],
346
+ # elem_id="column-select",
347
+ # container=False,
348
+ # )
349
+ # shown_columns_dict[task_type.name] = shown_column
 
 
350
  with gr.Row():
351
  filter_columns_type = gr.CheckboxGroup(
352
  label="Model types",
 
444
  # Check query parameter once at startup and update search bar + hidden component
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:
style.css CHANGED
@@ -100,14 +100,6 @@ table th:first-child {
100
  margin: 20px 0;
101
  }
102
 
103
- /* Hides the final AutoEvalColumn */
104
- #llm-benchmark-tab-table table td:nth-last-child(2),
105
- #llm-benchmark-tab-table table th:nth-last-child(2),
106
- #llm-benchmark-tab-table table td:last-child,
107
- #llm-benchmark-tab-table table th:last-child {
108
- display: none;
109
- }
110
-
111
  /* Full width space */
112
  .gradio-container {
113
  max-width: 95%!important;
 
100
  margin: 20px 0;
101
  }
102
 
 
 
 
 
 
 
 
 
103
  /* Full width space */
104
  .gradio-container {
105
  max-width: 95%!important;