Spaces:
AIR-Bench
/
Running on CPU Upgrade

nan commited on
Commit
4ab9cec
1 Parent(s): fff686a

feat: add toggle checkbox for long-doc

Browse files
Files changed (2) hide show
  1. app.py +49 -45
  2. src/utils.py +9 -5
app.py CHANGED
@@ -51,6 +51,7 @@ leaderboard_df_long_doc = original_df_long_doc.copy()
51
  shown_columns_long_doc, types_long_doc = get_default_cols(
52
  'long-doc', leaderboard_df_long_doc.columns, add_fix_cols=True)
53
  leaderboard_df_long_doc = leaderboard_df_long_doc[~leaderboard_df_long_doc[COL_NAME_IS_ANONYMOUS]][shown_columns_long_doc]
 
54
 
55
 
56
  def update_metric_qa(
@@ -59,9 +60,10 @@ def update_metric_qa(
59
  langs: list,
60
  reranking_model: list,
61
  query: str,
62
- show_anonymous: bool
 
63
  ):
64
- return update_metric(raw_data, 'qa', metric, domains, langs, reranking_model, query, show_anonymous)
65
 
66
 
67
  def update_metric_long_doc(
@@ -70,9 +72,10 @@ def update_metric_long_doc(
70
  langs: list,
71
  reranking_model: list,
72
  query: str,
73
- show_anonymous: bool
 
74
  ):
75
- return update_metric(raw_data, "long-doc", metric, domains, langs, reranking_model, query, show_anonymous)
76
 
77
 
78
  def update_table_without_ranking(
@@ -93,9 +96,10 @@ def update_table_without_ranking_long_doc(
93
  langs,
94
  reranking_query,
95
  query,
96
- show_anonymous
 
97
  ):
98
- return update_table_long_doc(hidden_df, domains, langs, reranking_query, query, show_anonymous, reset_ranking=False)
99
 
100
 
101
  demo = gr.Blocks(css=custom_css)
@@ -195,33 +199,21 @@ with demo:
195
  leaderboard_table,
196
  )
197
 
198
- show_revision_and_timestamp.change(
199
- update_table_without_ranking,
200
- [
201
- hidden_leaderboard_table_for_search,
202
- selected_domains,
203
- selected_langs,
204
- selected_rerankings,
205
- search_bar,
206
- show_anonymous,
207
- show_revision_and_timestamp
208
- ],
209
- leaderboard_table
210
- )
211
-
212
- selected_rerankings.change(
213
- update_table_without_ranking,
214
- [
215
- hidden_leaderboard_table_for_search,
216
- selected_domains,
217
- selected_langs,
218
- selected_rerankings,
219
- search_bar,
220
- show_anonymous,
221
- show_revision_and_timestamp
222
- ],
223
- leaderboard_table,
224
- )
225
 
226
  # Set column-wise listener
227
  for selector in [
@@ -311,6 +303,12 @@ with demo:
311
  value=False,
312
  info="The anonymous submissions might have invalid model information."
313
  )
 
 
 
 
 
 
314
 
315
  leaderboard_table_long_doc = gr.components.Dataframe(
316
  value=leaderboard_df_long_doc,
@@ -337,22 +335,26 @@ with demo:
337
  selected_rerankings,
338
  search_bar,
339
  show_anonymous,
 
340
  ],
341
  leaderboard_table_long_doc,
342
  )
343
 
344
- selected_rerankings.change(
345
- update_table_without_ranking_long_doc,
346
- [
347
- hidden_leaderboard_table_for_search,
348
- selected_domains,
349
- selected_langs,
350
- selected_rerankings,
351
- search_bar,
352
- show_anonymous,
353
- ],
354
- leaderboard_table_long_doc,
355
- )
 
 
 
356
 
357
  # Set column-wise listener
358
  for selector in [
@@ -367,6 +369,7 @@ with demo:
367
  selected_rerankings,
368
  search_bar,
369
  show_anonymous,
 
370
  ],
371
  leaderboard_table_long_doc,
372
  queue=True,
@@ -382,6 +385,7 @@ with demo:
382
  selected_rerankings,
383
  search_bar,
384
  show_anonymous,
 
385
  ],
386
  leaderboard_table_long_doc,
387
  queue=True
 
51
  shown_columns_long_doc, types_long_doc = get_default_cols(
52
  'long-doc', leaderboard_df_long_doc.columns, add_fix_cols=True)
53
  leaderboard_df_long_doc = leaderboard_df_long_doc[~leaderboard_df_long_doc[COL_NAME_IS_ANONYMOUS]][shown_columns_long_doc]
54
+ leaderboard_df_long_doc.drop([COL_NAME_REVISION, COL_NAME_TIMESTAMP], axis=1, inplace=True)
55
 
56
 
57
  def update_metric_qa(
 
60
  langs: list,
61
  reranking_model: list,
62
  query: str,
63
+ show_anonymous: bool,
64
+ show_revision_and_timestamp,
65
  ):
66
+ return update_metric(raw_data, 'qa', metric, domains, langs, reranking_model, query, show_anonymous, show_revision_and_timestamp)
67
 
68
 
69
  def update_metric_long_doc(
 
72
  langs: list,
73
  reranking_model: list,
74
  query: str,
75
+ show_anonymous: bool,
76
+ show_revision_and_timestamp,
77
  ):
78
+ return update_metric(raw_data, "long-doc", metric, domains, langs, reranking_model, query, show_anonymous, show_revision_and_timestamp)
79
 
80
 
81
  def update_table_without_ranking(
 
96
  langs,
97
  reranking_query,
98
  query,
99
+ show_anonymous,
100
+ show_revision_and_timestamp,
101
  ):
102
+ return update_table_long_doc(hidden_df, domains, langs, reranking_query, query, show_anonymous, reset_ranking=False, show_revision_and_timestamp=show_revision_and_timestamp)
103
 
104
 
105
  demo = gr.Blocks(css=custom_css)
 
199
  leaderboard_table,
200
  )
201
 
202
+ for selector in [show_revision_and_timestamp, selected_rerankings]:
203
+ selector.change(
204
+ update_table_without_ranking,
205
+ [
206
+ hidden_leaderboard_table_for_search,
207
+ selected_domains,
208
+ selected_langs,
209
+ selected_rerankings,
210
+ search_bar,
211
+ show_anonymous,
212
+ show_revision_and_timestamp
213
+ ],
214
+ leaderboard_table,
215
+ queue=True
216
+ )
 
 
 
 
 
 
 
 
 
 
 
 
217
 
218
  # Set column-wise listener
219
  for selector in [
 
303
  value=False,
304
  info="The anonymous submissions might have invalid model information."
305
  )
306
+ with gr.Row():
307
+ show_revision_and_timestamp = gr.Checkbox(
308
+ label="Show submission details",
309
+ value=False,
310
+ info="Show the revision and timestamp information of submissions"
311
+ )
312
 
313
  leaderboard_table_long_doc = gr.components.Dataframe(
314
  value=leaderboard_df_long_doc,
 
335
  selected_rerankings,
336
  search_bar,
337
  show_anonymous,
338
+ show_revision_and_timestamp
339
  ],
340
  leaderboard_table_long_doc,
341
  )
342
 
343
+ for selector in [show_revision_and_timestamp, selected_rerankings]:
344
+ selector.change(
345
+ update_table_without_ranking_long_doc,
346
+ [
347
+ hidden_leaderboard_table_for_search,
348
+ selected_domains,
349
+ selected_langs,
350
+ selected_rerankings,
351
+ search_bar,
352
+ show_anonymous,
353
+ show_revision_and_timestamp
354
+ ],
355
+ leaderboard_table_long_doc,
356
+ queue=True,
357
+ )
358
 
359
  # Set column-wise listener
360
  for selector in [
 
369
  selected_rerankings,
370
  search_bar,
371
  show_anonymous,
372
+ show_revision_and_timestamp
373
  ],
374
  leaderboard_table_long_doc,
375
  queue=True,
 
385
  selected_rerankings,
386
  search_bar,
387
  show_anonymous,
388
+ show_revision_and_timestamp
389
  ],
390
  leaderboard_table_long_doc,
391
  queue=True
src/utils.py CHANGED
@@ -165,10 +165,11 @@ def update_table_long_doc(
165
  reranking_query: list,
166
  query: str,
167
  show_anonymous: bool,
168
- reset_ranking: bool = True
 
169
  ):
170
  return _update_table(
171
- "long-doc", hidden_df, domains, langs, reranking_query, query, show_anonymous, reset_ranking)
172
 
173
 
174
  def update_metric(
@@ -179,7 +180,8 @@ def update_metric(
179
  langs: list,
180
  reranking_model: list,
181
  query: str,
182
- show_anonymous: bool = False
 
183
  ) -> pd.DataFrame:
184
  if task == 'qa':
185
  leaderboard_df = get_leaderboard_df(raw_data, task=task, metric=metric)
@@ -189,7 +191,8 @@ def update_metric(
189
  langs,
190
  reranking_model,
191
  query,
192
- show_anonymous
 
193
  )
194
  elif task == "long-doc":
195
  leaderboard_df = get_leaderboard_df(raw_data, task=task, metric=metric)
@@ -199,7 +202,8 @@ def update_metric(
199
  langs,
200
  reranking_model,
201
  query,
202
- show_anonymous
 
203
  )
204
 
205
 
 
165
  reranking_query: list,
166
  query: str,
167
  show_anonymous: bool,
168
+ reset_ranking: bool = True,
169
+ show_revision_and_timestamp: bool = False
170
  ):
171
  return _update_table(
172
+ "long-doc", hidden_df, domains, langs, reranking_query, query, show_anonymous, reset_ranking, show_revision_and_timestamp)
173
 
174
 
175
  def update_metric(
 
180
  langs: list,
181
  reranking_model: list,
182
  query: str,
183
+ show_anonymous: bool = False,
184
+ show_revision_and_timestamp: bool = False,
185
  ) -> pd.DataFrame:
186
  if task == 'qa':
187
  leaderboard_df = get_leaderboard_df(raw_data, task=task, metric=metric)
 
191
  langs,
192
  reranking_model,
193
  query,
194
+ show_anonymous,
195
+ show_revision_and_timestamp
196
  )
197
  elif task == "long-doc":
198
  leaderboard_df = get_leaderboard_df(raw_data, task=task, metric=metric)
 
202
  langs,
203
  reranking_model,
204
  query,
205
+ show_anonymous,
206
+ show_revision_and_timestamp
207
  )
208
 
209