Spaces:
AIR-Bench
/
Running on CPU Upgrade

nan commited on
Commit
fe361b7
·
1 Parent(s): 5e11615

refactor: refactor the naming

Browse files
Files changed (1) hide show
  1. app.py +71 -81
app.py CHANGED
@@ -149,17 +149,17 @@ with demo:
149
  with gr.Column(min_width=320):
150
  # select domain
151
  with gr.Row():
152
- selected_domains = get_domain_dropdown(QABenchmarks[datastore.slug])
153
  # select language
154
  with gr.Row():
155
- selected_langs = get_language_dropdown(QABenchmarks[datastore.slug])
156
  with gr.Column():
157
  # select the metric
158
- selected_metric = get_metric_dropdown(METRIC_LIST, DEFAULT_METRIC_QA)
159
  with gr.Row():
160
  show_anonymous = get_anonymous_checkbox()
161
  with gr.Row():
162
- show_revision_and_timestamp = get_revision_and_ts_checkbox()
163
  with gr.Tabs(elem_classes="tab-buttons") as sub_tabs:
164
  with gr.TabItem("Retrieval + Reranking", id=10):
165
  with gr.Row():
@@ -168,7 +168,7 @@ with demo:
168
  search_bar = get_search_bar()
169
  # select reranking models
170
  with gr.Column():
171
- selected_rerankings = get_reranking_dropdown(datastore.reranking_models)
172
  # shown_table
173
  lb_table = get_leaderboard_table(datastore.qa_fmt_df, datastore.qa_types)
174
  # Dummy leaderboard for handling the case when the user uses backspace key
@@ -176,10 +176,8 @@ with demo:
176
 
177
  version.change(
178
  update_qa_version,
179
- [
180
- version,
181
- ],
182
- [selected_domains, selected_langs, selected_rerankings, lb_table, hidden_lb_table],
183
  )
184
 
185
  set_listeners(
@@ -188,25 +186,17 @@ with demo:
188
  hidden_lb_table,
189
  search_bar,
190
  version,
191
- selected_domains,
192
- selected_langs,
193
- selected_rerankings,
194
  show_anonymous,
195
- show_revision_and_timestamp,
196
  )
197
 
198
  # set metric listener
199
- selected_metric.change(
200
  update_qa_metric,
201
- [
202
- selected_metric,
203
- selected_domains,
204
- selected_langs,
205
- selected_rerankings,
206
- search_bar,
207
- show_anonymous,
208
- show_revision_and_timestamp,
209
- ],
210
  lb_table,
211
  queue=True,
212
  )
@@ -239,8 +229,8 @@ with demo:
239
  version,
240
  ],
241
  [
242
- selected_domains,
243
- selected_langs,
244
  selected_noreranker,
245
  lb_table_retriever,
246
  hidden_lb_table_retriever,
@@ -253,24 +243,24 @@ with demo:
253
  hidden_lb_table_retriever,
254
  search_bar_retriever,
255
  version,
256
- selected_domains,
257
- selected_langs,
258
  selected_noreranker,
259
  show_anonymous,
260
- show_revision_and_timestamp,
261
  )
262
 
263
  # set metric listener
264
- selected_metric.change(
265
  update_qa_metric,
266
  [
267
- selected_metric,
268
- selected_domains,
269
- selected_langs,
270
  selected_noreranker,
271
  search_bar_retriever,
272
  show_anonymous,
273
- show_revision_and_timestamp,
274
  ],
275
  lb_table_retriever,
276
  queue=True,
@@ -304,8 +294,8 @@ with demo:
304
  version,
305
  ],
306
  [
307
- selected_domains,
308
- selected_langs,
309
  selected_rerankings_reranker,
310
  lb_table_reranker,
311
  hidden_lb_table_reranker,
@@ -318,23 +308,23 @@ with demo:
318
  hidden_lb_table_reranker,
319
  search_bar_reranker,
320
  version,
321
- selected_domains,
322
- selected_langs,
323
  selected_rerankings_reranker,
324
  show_anonymous,
325
- show_revision_and_timestamp,
326
  )
327
  # set metric listener
328
- selected_metric.change(
329
  update_qa_metric,
330
  [
331
- selected_metric,
332
- selected_domains,
333
- selected_langs,
334
  selected_rerankings_reranker,
335
  search_bar_reranker,
336
  show_anonymous,
337
- show_revision_and_timestamp,
338
  ],
339
  lb_table_reranker,
340
  queue=True,
@@ -344,25 +334,25 @@ with demo:
344
  with gr.Column(min_width=320):
345
  # select domain
346
  with gr.Row():
347
- selected_domains = get_domain_dropdown(LongDocBenchmarks[datastore.slug])
348
  # select language
349
  with gr.Row():
350
- selected_langs = get_language_dropdown(LongDocBenchmarks[datastore.slug])
351
  with gr.Column():
352
  # select the metric
353
  with gr.Row():
354
- selected_metric = get_metric_dropdown(METRIC_LIST, DEFAULT_METRIC_LONG_DOC)
355
  with gr.Row():
356
  show_anonymous = get_anonymous_checkbox()
357
  with gr.Row():
358
- show_revision_and_timestamp = get_revision_and_ts_checkbox()
359
  with gr.Tabs(elem_classes="tab-buttons"):
360
  with gr.TabItem("Retrieval + Reranking", id=20):
361
  with gr.Row():
362
  with gr.Column():
363
  search_bar = get_search_bar()
364
  with gr.Column():
365
- selected_rerankings = get_reranking_dropdown(datastore.reranking_models)
366
 
367
  lb_table_long_doc = get_leaderboard_table(
368
  datastore.doc_fmt_df, datastore.doc_types
@@ -379,9 +369,9 @@ with demo:
379
  version,
380
  ],
381
  [
382
- selected_domains,
383
- selected_langs,
384
- selected_rerankings,
385
  lb_table_long_doc,
386
  hidden_lb_table_long_doc,
387
  ],
@@ -393,24 +383,24 @@ with demo:
393
  hidden_lb_table_long_doc,
394
  search_bar,
395
  version,
396
- selected_domains,
397
- selected_langs,
398
- selected_rerankings,
399
  show_anonymous,
400
- show_revision_and_timestamp,
401
  )
402
 
403
  # set metric listener
404
- selected_metric.change(
405
  update_doc_metric,
406
  [
407
- selected_metric,
408
- selected_domains,
409
- selected_langs,
410
- selected_rerankings,
411
  search_bar,
412
  show_anonymous,
413
- show_revision_and_timestamp,
414
  ],
415
  lb_table_long_doc,
416
  queue=True,
@@ -443,8 +433,8 @@ with demo:
443
  version,
444
  ],
445
  [
446
- selected_domains,
447
- selected_langs,
448
  selected_noreranker,
449
  lb_table_retriever_long_doc,
450
  hidden_lb_table_retriever_long_doc,
@@ -457,23 +447,23 @@ with demo:
457
  hidden_lb_table_retriever_long_doc,
458
  search_bar_retriever,
459
  version,
460
- selected_domains,
461
- selected_langs,
462
  selected_noreranker,
463
  show_anonymous,
464
- show_revision_and_timestamp,
465
  )
466
 
467
- selected_metric.change(
468
  update_doc_metric,
469
  [
470
- selected_metric,
471
- selected_domains,
472
- selected_langs,
473
  selected_noreranker,
474
  search_bar_retriever,
475
  show_anonymous,
476
- show_revision_and_timestamp,
477
  ],
478
  lb_table_retriever_long_doc,
479
  queue=True,
@@ -508,8 +498,8 @@ with demo:
508
  version,
509
  ],
510
  [
511
- selected_domains,
512
- selected_langs,
513
  selected_rerankings_reranker_ldoc,
514
  lb_table_reranker_ldoc,
515
  hidden_lb_table_reranker_ldoc,
@@ -522,22 +512,22 @@ with demo:
522
  hidden_lb_table_reranker_ldoc,
523
  search_bar_reranker_ldoc,
524
  version,
525
- selected_domains,
526
- selected_langs,
527
  selected_rerankings_reranker_ldoc,
528
  show_anonymous,
529
- show_revision_and_timestamp,
530
  )
531
- selected_metric.change(
532
  update_doc_metric,
533
  [
534
- selected_metric,
535
- selected_domains,
536
- selected_langs,
537
  selected_rerankings_reranker_ldoc,
538
  search_bar_reranker_ldoc,
539
  show_anonymous,
540
- show_revision_and_timestamp,
541
  ],
542
  lb_table_reranker_ldoc,
543
  queue=True,
 
149
  with gr.Column(min_width=320):
150
  # select domain
151
  with gr.Row():
152
+ domains = get_domain_dropdown(QABenchmarks[datastore.slug])
153
  # select language
154
  with gr.Row():
155
+ langs = get_language_dropdown(QABenchmarks[datastore.slug])
156
  with gr.Column():
157
  # select the metric
158
+ metric = get_metric_dropdown(METRIC_LIST, DEFAULT_METRIC_QA)
159
  with gr.Row():
160
  show_anonymous = get_anonymous_checkbox()
161
  with gr.Row():
162
+ show_rev_ts = get_revision_and_ts_checkbox()
163
  with gr.Tabs(elem_classes="tab-buttons") as sub_tabs:
164
  with gr.TabItem("Retrieval + Reranking", id=10):
165
  with gr.Row():
 
168
  search_bar = get_search_bar()
169
  # select reranking models
170
  with gr.Column():
171
+ models = get_reranking_dropdown(datastore.reranking_models)
172
  # shown_table
173
  lb_table = get_leaderboard_table(datastore.qa_fmt_df, datastore.qa_types)
174
  # Dummy leaderboard for handling the case when the user uses backspace key
 
176
 
177
  version.change(
178
  update_qa_version,
179
+ version,
180
+ [domains, langs, models, lb_table, hidden_lb_table],
 
 
181
  )
182
 
183
  set_listeners(
 
186
  hidden_lb_table,
187
  search_bar,
188
  version,
189
+ domains,
190
+ langs,
191
+ models,
192
  show_anonymous,
193
+ show_rev_ts,
194
  )
195
 
196
  # set metric listener
197
+ metric.change(
198
  update_qa_metric,
199
+ [metric, domains, langs, models, search_bar, show_anonymous, show_rev_ts],
 
 
 
 
 
 
 
 
200
  lb_table,
201
  queue=True,
202
  )
 
229
  version,
230
  ],
231
  [
232
+ domains,
233
+ langs,
234
  selected_noreranker,
235
  lb_table_retriever,
236
  hidden_lb_table_retriever,
 
243
  hidden_lb_table_retriever,
244
  search_bar_retriever,
245
  version,
246
+ domains,
247
+ langs,
248
  selected_noreranker,
249
  show_anonymous,
250
+ show_rev_ts,
251
  )
252
 
253
  # set metric listener
254
+ metric.change(
255
  update_qa_metric,
256
  [
257
+ metric,
258
+ domains,
259
+ langs,
260
  selected_noreranker,
261
  search_bar_retriever,
262
  show_anonymous,
263
+ show_rev_ts,
264
  ],
265
  lb_table_retriever,
266
  queue=True,
 
294
  version,
295
  ],
296
  [
297
+ domains,
298
+ langs,
299
  selected_rerankings_reranker,
300
  lb_table_reranker,
301
  hidden_lb_table_reranker,
 
308
  hidden_lb_table_reranker,
309
  search_bar_reranker,
310
  version,
311
+ domains,
312
+ langs,
313
  selected_rerankings_reranker,
314
  show_anonymous,
315
+ show_rev_ts,
316
  )
317
  # set metric listener
318
+ metric.change(
319
  update_qa_metric,
320
  [
321
+ metric,
322
+ domains,
323
+ langs,
324
  selected_rerankings_reranker,
325
  search_bar_reranker,
326
  show_anonymous,
327
+ show_rev_ts,
328
  ],
329
  lb_table_reranker,
330
  queue=True,
 
334
  with gr.Column(min_width=320):
335
  # select domain
336
  with gr.Row():
337
+ domains = get_domain_dropdown(LongDocBenchmarks[datastore.slug])
338
  # select language
339
  with gr.Row():
340
+ langs = get_language_dropdown(LongDocBenchmarks[datastore.slug])
341
  with gr.Column():
342
  # select the metric
343
  with gr.Row():
344
+ metric = get_metric_dropdown(METRIC_LIST, DEFAULT_METRIC_LONG_DOC)
345
  with gr.Row():
346
  show_anonymous = get_anonymous_checkbox()
347
  with gr.Row():
348
+ show_rev_ts = get_revision_and_ts_checkbox()
349
  with gr.Tabs(elem_classes="tab-buttons"):
350
  with gr.TabItem("Retrieval + Reranking", id=20):
351
  with gr.Row():
352
  with gr.Column():
353
  search_bar = get_search_bar()
354
  with gr.Column():
355
+ models = get_reranking_dropdown(datastore.reranking_models)
356
 
357
  lb_table_long_doc = get_leaderboard_table(
358
  datastore.doc_fmt_df, datastore.doc_types
 
369
  version,
370
  ],
371
  [
372
+ domains,
373
+ langs,
374
+ models,
375
  lb_table_long_doc,
376
  hidden_lb_table_long_doc,
377
  ],
 
383
  hidden_lb_table_long_doc,
384
  search_bar,
385
  version,
386
+ domains,
387
+ langs,
388
+ models,
389
  show_anonymous,
390
+ show_rev_ts,
391
  )
392
 
393
  # set metric listener
394
+ metric.change(
395
  update_doc_metric,
396
  [
397
+ metric,
398
+ domains,
399
+ langs,
400
+ models,
401
  search_bar,
402
  show_anonymous,
403
+ show_rev_ts,
404
  ],
405
  lb_table_long_doc,
406
  queue=True,
 
433
  version,
434
  ],
435
  [
436
+ domains,
437
+ langs,
438
  selected_noreranker,
439
  lb_table_retriever_long_doc,
440
  hidden_lb_table_retriever_long_doc,
 
447
  hidden_lb_table_retriever_long_doc,
448
  search_bar_retriever,
449
  version,
450
+ domains,
451
+ langs,
452
  selected_noreranker,
453
  show_anonymous,
454
+ show_rev_ts,
455
  )
456
 
457
+ metric.change(
458
  update_doc_metric,
459
  [
460
+ metric,
461
+ domains,
462
+ langs,
463
  selected_noreranker,
464
  search_bar_retriever,
465
  show_anonymous,
466
+ show_rev_ts,
467
  ],
468
  lb_table_retriever_long_doc,
469
  queue=True,
 
498
  version,
499
  ],
500
  [
501
+ domains,
502
+ langs,
503
  selected_rerankings_reranker_ldoc,
504
  lb_table_reranker_ldoc,
505
  hidden_lb_table_reranker_ldoc,
 
512
  hidden_lb_table_reranker_ldoc,
513
  search_bar_reranker_ldoc,
514
  version,
515
+ domains,
516
+ langs,
517
  selected_rerankings_reranker_ldoc,
518
  show_anonymous,
519
+ show_rev_ts,
520
  )
521
+ metric.change(
522
  update_doc_metric,
523
  [
524
+ metric,
525
+ domains,
526
+ langs,
527
  selected_rerankings_reranker_ldoc,
528
  search_bar_reranker_ldoc,
529
  show_anonymous,
530
+ show_rev_ts,
531
  ],
532
  lb_table_reranker_ldoc,
533
  queue=True,