Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
fix: fix the missing file
Browse files
src/display/gradio_listener.py
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from src.utils import update_table, update_table_long_doc, clear_reranking_selections
|
2 |
+
|
3 |
+
|
4 |
+
def set_listeners(
|
5 |
+
task,
|
6 |
+
displayed_leaderboard,
|
7 |
+
hidden_leaderboard,
|
8 |
+
search_bar,
|
9 |
+
select_noreranker_only_btn,
|
10 |
+
selected_domains,
|
11 |
+
selected_langs,
|
12 |
+
selected_rerankings,
|
13 |
+
show_anonymous,
|
14 |
+
show_revision_and_timestamp,
|
15 |
+
|
16 |
+
):
|
17 |
+
if task == "qa":
|
18 |
+
update_table_func = update_table
|
19 |
+
elif task == "long-doc":
|
20 |
+
update_table_func = update_table_long_doc
|
21 |
+
else:
|
22 |
+
raise NotImplementedError
|
23 |
+
# Set search_bar listener
|
24 |
+
search_bar.submit(
|
25 |
+
update_table_func,
|
26 |
+
[
|
27 |
+
hidden_leaderboard, # hidden_leaderboard_table_for_search,
|
28 |
+
selected_domains,
|
29 |
+
selected_langs,
|
30 |
+
selected_rerankings,
|
31 |
+
search_bar,
|
32 |
+
show_anonymous,
|
33 |
+
],
|
34 |
+
displayed_leaderboard
|
35 |
+
)
|
36 |
+
|
37 |
+
# Set column-wise listener
|
38 |
+
for selector in [
|
39 |
+
selected_domains, selected_langs, show_anonymous, show_revision_and_timestamp, selected_rerankings
|
40 |
+
]:
|
41 |
+
selector.change(
|
42 |
+
update_table_func,
|
43 |
+
[
|
44 |
+
hidden_leaderboard,
|
45 |
+
selected_domains,
|
46 |
+
selected_langs,
|
47 |
+
selected_rerankings,
|
48 |
+
search_bar,
|
49 |
+
show_anonymous,
|
50 |
+
show_revision_and_timestamp
|
51 |
+
],
|
52 |
+
displayed_leaderboard,
|
53 |
+
queue=True,
|
54 |
+
)
|
55 |
+
|
56 |
+
|
57 |
+
select_noreranker_only_btn.click(
|
58 |
+
clear_reranking_selections,
|
59 |
+
outputs=selected_rerankings
|
60 |
+
)
|