Spaces:
Running
Running
Add columns of Hugging Face Models and Datasets
Browse files- app.py +2 -0
- paper_list.py +23 -8
- papers.csv +2 -2
app.py
CHANGED
@@ -21,6 +21,8 @@ def main():
|
|
21 |
'arXiv',
|
22 |
'GitHub',
|
23 |
'HF Space',
|
|
|
|
|
24 |
],
|
25 |
label='With')
|
26 |
search_box = gr.Textbox(
|
|
|
21 |
'arXiv',
|
22 |
'GitHub',
|
23 |
'HF Space',
|
24 |
+
'HF Model',
|
25 |
+
'HF Dataset',
|
26 |
],
|
27 |
label='With')
|
28 |
search_box = gr.Textbox(
|
paper_list.py
CHANGED
@@ -11,12 +11,14 @@ class PaperList:
|
|
11 |
self.table_header = '''
|
12 |
<tr>
|
13 |
<td width="50%">Paper</td>
|
14 |
-
<td width="
|
15 |
-
<td width="
|
16 |
-
<td width="
|
17 |
-
<td width="
|
18 |
-
<td width="
|
19 |
-
<td width="
|
|
|
|
|
20 |
</tr>'''
|
21 |
|
22 |
def _preprcess_table(self) -> None:
|
@@ -34,6 +36,10 @@ class PaperList:
|
|
34 |
row.github, str) else ''
|
35 |
hf_space = f'<a href="{row.hf_space}" target="_blank">Space</a>' if isinstance(
|
36 |
row.hf_space, str) else ''
|
|
|
|
|
|
|
|
|
37 |
row = f'''
|
38 |
<tr>
|
39 |
<td>{paper}</td>
|
@@ -43,6 +49,8 @@ class PaperList:
|
|
43 |
<td>{arxiv}</td>
|
44 |
<td>{github}</td>
|
45 |
<td>{hf_space}</td>
|
|
|
|
|
46 |
</tr>'''
|
47 |
rows.append(row)
|
48 |
self.table['html_table_content'] = rows
|
@@ -59,12 +67,15 @@ class PaperList:
|
|
59 |
has_arxiv = 'arXiv' in filter_names
|
60 |
has_github = 'GitHub' in filter_names
|
61 |
has_hf_space = 'HF Space' in filter_names
|
|
|
|
|
62 |
df = self.filter_table(df, has_supp, has_arxiv, has_github,
|
63 |
-
has_hf_space)
|
64 |
return len(df), self.to_html(df)
|
65 |
|
66 |
def filter_table(self, df: pd.DataFrame, has_supp: bool, has_arxiv: bool,
|
67 |
-
has_github: bool, has_hf_space: bool
|
|
|
68 |
if has_supp:
|
69 |
df = df[~df.supp.isna()]
|
70 |
if has_arxiv:
|
@@ -73,6 +84,10 @@ class PaperList:
|
|
73 |
df = df[~df.github.isna()]
|
74 |
if has_hf_space:
|
75 |
df = df[~df.hf_space.isna()]
|
|
|
|
|
|
|
|
|
76 |
return df
|
77 |
|
78 |
def to_html(self, df: pd.DataFrame) -> str:
|
|
|
11 |
self.table_header = '''
|
12 |
<tr>
|
13 |
<td width="50%">Paper</td>
|
14 |
+
<td width="22%">Authors</td>
|
15 |
+
<td width="4%">pdf</td>
|
16 |
+
<td width="4%">Supp</td>
|
17 |
+
<td width="4%">arXiv</td>
|
18 |
+
<td width="4%">GitHub</td>
|
19 |
+
<td width="4%">HF Spaces</td>
|
20 |
+
<td width="4%">HF Models</td>
|
21 |
+
<td width="4%">HF Datasets</td>
|
22 |
</tr>'''
|
23 |
|
24 |
def _preprcess_table(self) -> None:
|
|
|
36 |
row.github, str) else ''
|
37 |
hf_space = f'<a href="{row.hf_space}" target="_blank">Space</a>' if isinstance(
|
38 |
row.hf_space, str) else ''
|
39 |
+
hf_model = f'<a href="{row.hf_model}" target="_blank">Model</a>' if isinstance(
|
40 |
+
row.hf_model, str) else ''
|
41 |
+
hf_dataset = f'<a href="{row.hf_dataset}" target="_blank">Dataset</a>' if isinstance(
|
42 |
+
row.hf_dataset, str) else ''
|
43 |
row = f'''
|
44 |
<tr>
|
45 |
<td>{paper}</td>
|
|
|
49 |
<td>{arxiv}</td>
|
50 |
<td>{github}</td>
|
51 |
<td>{hf_space}</td>
|
52 |
+
<td>{hf_model}</td>
|
53 |
+
<td>{hf_dataset}</td>
|
54 |
</tr>'''
|
55 |
rows.append(row)
|
56 |
self.table['html_table_content'] = rows
|
|
|
67 |
has_arxiv = 'arXiv' in filter_names
|
68 |
has_github = 'GitHub' in filter_names
|
69 |
has_hf_space = 'HF Space' in filter_names
|
70 |
+
has_hf_model = 'HF Model' in filter_names
|
71 |
+
has_hf_dataset = 'HF Dataset' in filter_names
|
72 |
df = self.filter_table(df, has_supp, has_arxiv, has_github,
|
73 |
+
has_hf_space, has_hf_model, has_hf_dataset)
|
74 |
return len(df), self.to_html(df)
|
75 |
|
76 |
def filter_table(self, df: pd.DataFrame, has_supp: bool, has_arxiv: bool,
|
77 |
+
has_github: bool, has_hf_space: bool, has_hf_model: bool,
|
78 |
+
has_hf_dataset: bool) -> pd.DataFrame:
|
79 |
if has_supp:
|
80 |
df = df[~df.supp.isna()]
|
81 |
if has_arxiv:
|
|
|
84 |
df = df[~df.github.isna()]
|
85 |
if has_hf_space:
|
86 |
df = df[~df.hf_space.isna()]
|
87 |
+
if has_hf_model:
|
88 |
+
df = df[~df.hf_model.isna()]
|
89 |
+
if has_hf_dataset:
|
90 |
+
df = df[~df.hf_dataset.isna()]
|
91 |
return df
|
92 |
|
93 |
def to_html(self, df: pd.DataFrame) -> str:
|
papers.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:468cc57c8da9a9f2eac6d9363f7c19221e1f03fe72f41ca0df19f0029185ffb6
|
3 |
+
size 1144297
|