Spaces:
AIR-Bench
/
Running on CPU Upgrade

nan commited on
Commit
f8b3d0f
1 Parent(s): 1e768ec

feat: add listeners for columns

Browse files
Files changed (2) hide show
  1. app.py +21 -22
  2. utils.py +4 -3
app.py CHANGED
@@ -87,7 +87,7 @@ with demo:
87
  interactive=True
88
  )
89
  # select reranking models
90
- reranking_models = list(frozenset([eval_result.retrieval_model for eval_result in raw_data_qa]))
91
  with gr.Row():
92
  selected_rerankings = gr.CheckboxGroup(
93
  choices=reranking_models,
@@ -104,26 +104,24 @@ with demo:
104
  interactive=True,
105
  elem_id="metric-select",
106
  )
107
- # update shown_columns when selected_langs and selected_domains are changed
108
- shown_columns = leaderboard_df.columns
109
 
110
  # reload the leaderboard_df and raw_data when selected_metric is changed
111
  leaderboard_table = gr.components.Dataframe(
112
  value=leaderboard_df,
113
  # headers=shown_columns,
114
- datatype=TYPES,
115
  elem_id="leaderboard-table",
116
  interactive=False,
117
  visible=True,
118
  )
119
 
120
  # Dummy leaderboard for handling the case when the user uses backspace key
121
- # hidden_leaderboard_table_for_search = gr.components.Dataframe(
122
- # value=original_df_qa[COLS],
123
- # headers=COLS,
124
- # datatype=TYPES,
125
- # visible=False,
126
- # )
127
  # search_bar.submit(
128
  # update_table,
129
  # [
@@ -134,18 +132,19 @@ with demo:
134
  # ],
135
  # leaderboard_table,
136
  # )
137
- # for selector in [shown_columns, selected_rerankings, search_bar]:
138
- # selector.change(
139
- # update_table,
140
- # [
141
- # hidden_leaderboard_table_for_search,
142
- # shown_columns,
143
- # selected_rerankings,
144
- # search_bar,
145
- # ],
146
- # leaderboard_table,
147
- # queue=True,
148
- # )
 
149
 
150
  with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
151
  gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
 
87
  interactive=True
88
  )
89
  # select reranking models
90
+ reranking_models = list(frozenset([eval_result.reranking_model for eval_result in raw_data_qa]))
91
  with gr.Row():
92
  selected_rerankings = gr.CheckboxGroup(
93
  choices=reranking_models,
 
104
  interactive=True,
105
  elem_id="metric-select",
106
  )
 
 
107
 
108
  # reload the leaderboard_df and raw_data when selected_metric is changed
109
  leaderboard_table = gr.components.Dataframe(
110
  value=leaderboard_df,
111
  # headers=shown_columns,
112
+ # datatype=TYPES,
113
  elem_id="leaderboard-table",
114
  interactive=False,
115
  visible=True,
116
  )
117
 
118
  # Dummy leaderboard for handling the case when the user uses backspace key
119
+ hidden_leaderboard_table_for_search = gr.components.Dataframe(
120
+ value=original_df_qa,
121
+ # headers=COLS,
122
+ # datatype=TYPES,
123
+ visible=False,
124
+ )
125
  # search_bar.submit(
126
  # update_table,
127
  # [
 
132
  # ],
133
  # leaderboard_table,
134
  # )
135
+ for selector in [selected_domains, selected_langs]:
136
+ selector.change(
137
+ update_table,
138
+ [
139
+ hidden_leaderboard_table_for_search,
140
+ selected_domains,
141
+ selected_langs,
142
+ selected_rerankings,
143
+ search_bar,
144
+ ],
145
+ leaderboard_table,
146
+ queue=True,
147
+ )
148
 
149
  with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
150
  gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
utils.py CHANGED
@@ -60,11 +60,12 @@ def select_columns(df: pd.DataFrame, domain_query: list, language_query: list) -
60
 
61
  def update_table(
62
  hidden_df: pd.DataFrame,
63
- columns: list,
 
64
  reranking_query: list,
65
  query: str,
66
  ):
67
  filtered_df = filter_models(hidden_df, reranking_query)
68
  filtered_df = filter_queries(query, filtered_df)
69
- df = select_columns(filtered_df, columns)
70
- return df
 
60
 
61
  def update_table(
62
  hidden_df: pd.DataFrame,
63
+ domains: list,
64
+ langs: list,
65
  reranking_query: list,
66
  query: str,
67
  ):
68
  filtered_df = filter_models(hidden_df, reranking_query)
69
  filtered_df = filter_queries(query, filtered_df)
70
+ df = select_columns(filtered_df, domains, langs)
71
+ return df