hysts HF staff commited on
Commit
ba2c044
1 Parent(s): 168461f

Change button labels depending on the selected language

Browse files
Files changed (1) hide show
  1. app.py +32 -4
app.py CHANGED
@@ -313,6 +313,15 @@ leaderboard_df_filtered = select_columns(leaderboard_df, initial_columns)
313
 
314
  # Leaderboard demo
315
 
 
 
 
 
 
 
 
 
 
316
  with gr.Blocks() as demo_leaderboard:
317
  with gr.Row():
318
  search_bar = gr.Textbox(
@@ -324,9 +333,9 @@ with gr.Blocks() as demo_leaderboard:
324
  shown_columns_dict = {}
325
  checkboxes = []
326
  with gr.Row():
327
- select_all_button = gr.Button("全選択", size="sm")
328
- select_none_button = gr.Button("全解除", size="sm")
329
- select_avg_only_button = gr.Button("AVGのみ", size="sm")
330
 
331
  for task_type in TaskType:
332
  if task_type == TaskType.NotTask:
@@ -603,13 +612,26 @@ def set_default_language(request: gr.Request) -> gr.Radio:
603
  return gr.Radio(value="🇺🇸 EN")
604
 
605
 
606
- def update_language(language: str) -> tuple[gr.Markdown, gr.Markdown, gr.Markdown, gr.Textbox]:
 
 
 
 
 
 
 
 
 
 
607
  if language == "🇯🇵 JA":
608
  return (
609
  gr.Markdown(value=INTRODUCTION_TEXT_JA),
610
  gr.Markdown(value=LLM_BENCHMARKS_TEXT_JA),
611
  gr.Markdown(value=EVALUATION_QUEUE_TEXT_JA),
612
  gr.Textbox(label=CITATION_BUTTON_LABEL_JA),
 
 
 
613
  )
614
  else:
615
  return (
@@ -617,6 +639,9 @@ def update_language(language: str) -> tuple[gr.Markdown, gr.Markdown, gr.Markdow
617
  gr.Markdown(value=LLM_BENCHMARKS_TEXT),
618
  gr.Markdown(value=EVALUATION_QUEUE_TEXT),
619
  gr.Textbox(label=CITATION_BUTTON_LABEL),
 
 
 
620
  )
621
 
622
 
@@ -662,6 +687,9 @@ with gr.Blocks(css_paths="style.css", theme=gr.themes.Glass()) as demo:
662
  llm_benchmarks_text,
663
  evaluation_queue_text,
664
  citation_button,
 
 
 
665
  ],
666
  api_name=False,
667
  )
 
313
 
314
  # Leaderboard demo
315
 
316
+
317
+ SELECT_ALL_BUTTON_LABEL = "Select All"
318
+ SELECT_ALL_BUTTON_LABEL_JA = "全選択"
319
+ SELECT_NONE_BUTTON_LABEL = "Select None"
320
+ SELECT_NONE_BUTTON_LABEL_JA = "全解除"
321
+ SELECT_AVG_ONLY_BUTTON_LABEL = "AVG Only"
322
+ SELECT_AVG_ONLY_BUTTON_LABEL_JA = "AVGのみ"
323
+
324
+
325
  with gr.Blocks() as demo_leaderboard:
326
  with gr.Row():
327
  search_bar = gr.Textbox(
 
333
  shown_columns_dict = {}
334
  checkboxes = []
335
  with gr.Row():
336
+ select_all_button = gr.Button(SELECT_ALL_BUTTON_LABEL_JA, size="sm")
337
+ select_none_button = gr.Button(SELECT_NONE_BUTTON_LABEL_JA, size="sm")
338
+ select_avg_only_button = gr.Button(SELECT_AVG_ONLY_BUTTON_LABEL_JA, size="sm")
339
 
340
  for task_type in TaskType:
341
  if task_type == TaskType.NotTask:
 
612
  return gr.Radio(value="🇺🇸 EN")
613
 
614
 
615
+ def update_language(
616
+ language: str,
617
+ ) -> tuple[
618
+ gr.Markdown,
619
+ gr.Markdown,
620
+ gr.Markdown,
621
+ gr.Textbox,
622
+ gr.Button,
623
+ gr.Button,
624
+ gr.Button,
625
+ ]:
626
  if language == "🇯🇵 JA":
627
  return (
628
  gr.Markdown(value=INTRODUCTION_TEXT_JA),
629
  gr.Markdown(value=LLM_BENCHMARKS_TEXT_JA),
630
  gr.Markdown(value=EVALUATION_QUEUE_TEXT_JA),
631
  gr.Textbox(label=CITATION_BUTTON_LABEL_JA),
632
+ gr.Button(value=SELECT_ALL_BUTTON_LABEL_JA),
633
+ gr.Button(value=SELECT_NONE_BUTTON_LABEL_JA),
634
+ gr.Button(value=SELECT_AVG_ONLY_BUTTON_LABEL_JA),
635
  )
636
  else:
637
  return (
 
639
  gr.Markdown(value=LLM_BENCHMARKS_TEXT),
640
  gr.Markdown(value=EVALUATION_QUEUE_TEXT),
641
  gr.Textbox(label=CITATION_BUTTON_LABEL),
642
+ gr.Button(value=SELECT_ALL_BUTTON_LABEL),
643
+ gr.Button(value=SELECT_NONE_BUTTON_LABEL),
644
+ gr.Button(value=SELECT_AVG_ONLY_BUTTON_LABEL),
645
  )
646
 
647
 
 
687
  llm_benchmarks_text,
688
  evaluation_queue_text,
689
  citation_button,
690
+ select_all_button,
691
+ select_none_button,
692
+ select_avg_only_button,
693
  ],
694
  api_name=False,
695
  )