pufanyi commited on
Commit
6763f93
1 Parent(s): 59453ee

Refactor init_leaderboard function to update data outputs to dataframe and improve dropdown UI

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -3,6 +3,9 @@ from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
3
  import pandas as pd
4
  from apscheduler.schedulers.background import BackgroundScheduler
5
  from huggingface_hub import snapshot_download
 
 
 
6
 
7
  # from fastchat.serve.monitor.monitor import build_leaderboard_tab, build_basic_stats_tab, basic_component_values, leader_component_values
8
 
@@ -94,7 +97,9 @@ def init_leaderboard(dataframes):
94
  selected_subset.choices = subsets
95
  return update_data(subset, research_textbox, selected_columns)
96
 
97
- def update_data(subset, search_term, selected_columns):
 
 
98
  print(subset)
99
  print(search_term)
100
  print(selected_columns)
 
3
  import pandas as pd
4
  from apscheduler.schedulers.background import BackgroundScheduler
5
  from huggingface_hub import snapshot_download
6
+ from gradio.components.textbox import Textbox
7
+ from gradio.components.dataframe import Dataframe
8
+ from gradio.components.checkboxgroup import CheckboxGroup
9
 
10
  # from fastchat.serve.monitor.monitor import build_leaderboard_tab, build_basic_stats_tab, basic_component_values, leader_component_values
11
 
 
97
  selected_subset.choices = subsets
98
  return update_data(subset, research_textbox, selected_columns)
99
 
100
+ def update_data(subset, search_term: Textbox, selected_columns: CheckboxGroup):
101
+ search_term = search_term.value
102
+ selected_columns = selected_columns.value
103
  print(subset)
104
  print(search_term)
105
  print(selected_columns)