Spaces:
Running
Running
show number of papers found
Browse files
app.py
CHANGED
@@ -29,7 +29,10 @@ def main():
|
|
29 |
'HF Space',
|
30 |
],
|
31 |
label='With')
|
|
|
|
|
32 |
table = gr.HTML(show_label=False)
|
|
|
33 |
gr.Markdown(FOOTER)
|
34 |
|
35 |
demo.load(paper_list.render,
|
@@ -38,21 +41,30 @@ def main():
|
|
38 |
case_sensitive,
|
39 |
names_with_link,
|
40 |
],
|
41 |
-
outputs=
|
|
|
|
|
|
|
42 |
search_button.click(paper_list.render,
|
43 |
inputs=[
|
44 |
search_box,
|
45 |
case_sensitive,
|
46 |
names_with_link,
|
47 |
],
|
48 |
-
outputs=
|
|
|
|
|
|
|
49 |
names_with_link.change(paper_list.render,
|
50 |
inputs=[
|
51 |
search_box,
|
52 |
case_sensitive,
|
53 |
names_with_link,
|
54 |
],
|
55 |
-
outputs=
|
|
|
|
|
|
|
56 |
|
57 |
demo.launch(enable_queue=True, share=False)
|
58 |
|
|
|
29 |
'HF Space',
|
30 |
],
|
31 |
label='With')
|
32 |
+
|
33 |
+
number_of_papers = gr.Textbox(label='Number of found papers')
|
34 |
table = gr.HTML(show_label=False)
|
35 |
+
|
36 |
gr.Markdown(FOOTER)
|
37 |
|
38 |
demo.load(paper_list.render,
|
|
|
41 |
case_sensitive,
|
42 |
names_with_link,
|
43 |
],
|
44 |
+
outputs=[
|
45 |
+
number_of_papers,
|
46 |
+
table,
|
47 |
+
])
|
48 |
search_button.click(paper_list.render,
|
49 |
inputs=[
|
50 |
search_box,
|
51 |
case_sensitive,
|
52 |
names_with_link,
|
53 |
],
|
54 |
+
outputs=[
|
55 |
+
number_of_papers,
|
56 |
+
table,
|
57 |
+
])
|
58 |
names_with_link.change(paper_list.render,
|
59 |
inputs=[
|
60 |
search_box,
|
61 |
case_sensitive,
|
62 |
names_with_link,
|
63 |
],
|
64 |
+
outputs=[
|
65 |
+
number_of_papers,
|
66 |
+
table,
|
67 |
+
])
|
68 |
|
69 |
demo.launch(enable_queue=True, share=False)
|
70 |
|
papers.py
CHANGED
@@ -20,7 +20,7 @@ class PaperList:
|
|
20 |
</tr>'''
|
21 |
|
22 |
def render(self, search_query: str, case_sensitive: bool,
|
23 |
-
names_with_link: list[str]) -> str:
|
24 |
df = self.table
|
25 |
if search_query:
|
26 |
if case_sensitive:
|
@@ -33,7 +33,7 @@ class PaperList:
|
|
33 |
has_hf_space = 'HF Space' in names_with_link
|
34 |
df = self.filter_table(df, has_supp, has_arxiv, has_github,
|
35 |
has_hf_space)
|
36 |
-
return self.to_html(df)
|
37 |
|
38 |
def filter_table(self, df: pd.DataFrame, has_supp: bool, has_arxiv: bool,
|
39 |
has_github: bool, has_hf_space: bool) -> pd.DataFrame:
|
|
|
20 |
</tr>'''
|
21 |
|
22 |
def render(self, search_query: str, case_sensitive: bool,
|
23 |
+
names_with_link: list[str]) -> tuple[int, str]:
|
24 |
df = self.table
|
25 |
if search_query:
|
26 |
if case_sensitive:
|
|
|
33 |
has_hf_space = 'HF Space' in names_with_link
|
34 |
df = self.filter_table(df, has_supp, has_arxiv, has_github,
|
35 |
has_hf_space)
|
36 |
+
return len(df), self.to_html(df)
|
37 |
|
38 |
def filter_table(self, df: pd.DataFrame, has_supp: bool, has_arxiv: bool,
|
39 |
has_github: bool, has_hf_space: bool) -> pd.DataFrame:
|