t0-0 commited on
Commit
d1852d8
1 Parent(s): c367864

Split the group of checkboxes for selecting columns to display

Browse files
Files changed (1) hide show
  1. app.py +31 -17
app.py CHANGED
@@ -15,6 +15,7 @@ from src.about import (
15
  INTRODUCTION_TEXT_JP,
16
  LLM_BENCHMARKS_TEXT,
17
  TITLE,
 
18
  )
19
  from src.display.css_html_js import custom_css
20
  from src.display.utils import (
@@ -181,7 +182,6 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
181
 
182
  def update_table(
183
  hidden_df: pd.DataFrame,
184
- columns: list,
185
  type_query: list,
186
  precision_query: str,
187
  size_query: list,
@@ -190,7 +190,9 @@ def update_table(
190
  version_query: list,
191
  backend_query: list,
192
  query: str,
 
193
  ):
 
194
  print(
195
  f"Update table called with: type_query={type_query}, precision_query={precision_query}, size_query={size_query}"
196
  )
@@ -284,18 +286,30 @@ with gr.Blocks() as demo_leaderboard:
284
  elem_id="search-bar",
285
  )
286
  with gr.Row():
287
- shown_columns = gr.CheckboxGroup(
288
- label="Select columns to show",
289
- choices=[
290
- c.name for c in fields(AutoEvalColumn) if not c.hidden and not c.never_hidden and not c.dummy
291
- ],
292
- value=[
293
- c.name
294
- for c in fields(AutoEvalColumn)
295
- if c.displayed_by_default and not c.hidden and not c.never_hidden
296
- ],
297
- elem_id="column-select",
298
- )
 
 
 
 
 
 
 
 
 
 
 
 
299
  with gr.Column(min_width=320):
300
  filter_columns_type = gr.CheckboxGroup(
301
  label="Model types",
@@ -364,7 +378,6 @@ with gr.Blocks() as demo_leaderboard:
364
  gr.on(
365
  triggers=[
366
  hidden_search_bar.change,
367
- shown_columns.change,
368
  filter_columns_type.change,
369
  filter_columns_precision.change,
370
  filter_columns_size.change,
@@ -373,11 +386,11 @@ with gr.Blocks() as demo_leaderboard:
373
  filter_columns_version.change,
374
  filter_columns_backend.change,
375
  search_bar.submit,
376
- ],
 
377
  fn=update_table,
378
  inputs=[
379
  hidden_leaderboard_table_for_search,
380
- shown_columns,
381
  filter_columns_type,
382
  filter_columns_precision,
383
  filter_columns_size,
@@ -386,7 +399,8 @@ with gr.Blocks() as demo_leaderboard:
386
  filter_columns_version,
387
  filter_columns_backend,
388
  search_bar,
389
- ],
 
390
  outputs=leaderboard_table,
391
  )
392
 
 
15
  INTRODUCTION_TEXT_JP,
16
  LLM_BENCHMARKS_TEXT,
17
  TITLE,
18
+ TaskType,
19
  )
20
  from src.display.css_html_js import custom_css
21
  from src.display.utils import (
 
182
 
183
  def update_table(
184
  hidden_df: pd.DataFrame,
 
185
  type_query: list,
186
  precision_query: str,
187
  size_query: list,
 
190
  version_query: list,
191
  backend_query: list,
192
  query: str,
193
+ *columns,
194
  ):
195
+ columns = [item for column in columns for item in column]
196
  print(
197
  f"Update table called with: type_query={type_query}, precision_query={precision_query}, size_query={size_query}"
198
  )
 
286
  elem_id="search-bar",
287
  )
288
  with gr.Row():
289
+ shown_columns_dict = {}
290
+ for task_type in TaskType:
291
+ if task_type == TaskType.NotTask:
292
+ label = "Select columns to show"
293
+ else:
294
+ label = f"{task_type.name}(Select columns to show)"
295
+ shown_column = gr.CheckboxGroup(
296
+ label=label,
297
+ choices=[
298
+ c.name
299
+ for c in fields(AutoEvalColumn)
300
+ if not c.hidden and not c.never_hidden and not c.dummy and c.task_type == task_type
301
+ ],
302
+ value=[
303
+ c.name
304
+ for c in fields(AutoEvalColumn)
305
+ if c.displayed_by_default
306
+ and not c.hidden
307
+ and not c.never_hidden
308
+ and c.task_type == task_type
309
+ ],
310
+ elem_id="column-select",
311
+ )
312
+ shown_columns_dict[task_type.name] = shown_column
313
  with gr.Column(min_width=320):
314
  filter_columns_type = gr.CheckboxGroup(
315
  label="Model types",
 
378
  gr.on(
379
  triggers=[
380
  hidden_search_bar.change,
 
381
  filter_columns_type.change,
382
  filter_columns_precision.change,
383
  filter_columns_size.change,
 
386
  filter_columns_version.change,
387
  filter_columns_backend.change,
388
  search_bar.submit,
389
+ ]
390
+ + [shown_columns.change for shown_columns in shown_columns_dict.values()],
391
  fn=update_table,
392
  inputs=[
393
  hidden_leaderboard_table_for_search,
 
394
  filter_columns_type,
395
  filter_columns_precision,
396
  filter_columns_size,
 
399
  filter_columns_version,
400
  filter_columns_backend,
401
  search_bar,
402
+ ]
403
+ + [shown_columns for shown_columns in shown_columns_dict.values()],
404
  outputs=leaderboard_table,
405
  )
406