Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 1,447 Bytes
0646823 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
from src.utils import update_table, update_table_long_doc, clear_reranking_selections
def set_listeners(
task,
displayed_leaderboard,
hidden_leaderboard,
search_bar,
selected_domains,
selected_langs,
selected_rerankings,
show_anonymous,
show_revision_and_timestamp,
):
if task == "qa":
update_table_func = update_table
elif task == "long-doc":
update_table_func = update_table_long_doc
else:
raise NotImplementedError
# Set search_bar listener
search_bar.submit(
update_table_func,
[
hidden_leaderboard, # hidden_leaderboard_table_for_search,
selected_domains,
selected_langs,
selected_rerankings,
search_bar,
show_anonymous,
],
displayed_leaderboard
)
# Set column-wise listener
for selector in [
selected_domains, selected_langs, show_anonymous, show_revision_and_timestamp, selected_rerankings
]:
selector.change(
update_table_func,
[
hidden_leaderboard,
selected_domains,
selected_langs,
selected_rerankings,
search_bar,
show_anonymous,
show_revision_and_timestamp
],
displayed_leaderboard,
queue=True,
)
|