Spaces:
Running
Running
Add files
Browse files- .pre-commit-config.yaml +50 -0
- .vscode/settings.json +21 -0
- LICENSE +21 -0
- README.md +1 -0
- app.py +72 -0
- paper_list.py +106 -0
- papers.csv +0 -0
- requirements.txt +1 -0
- style.css +27 -0
.pre-commit-config.yaml
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
repos:
|
2 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
3 |
+
rev: v4.4.0
|
4 |
+
hooks:
|
5 |
+
- id: check-executables-have-shebangs
|
6 |
+
- id: check-json
|
7 |
+
- id: check-merge-conflict
|
8 |
+
- id: check-shebang-scripts-are-executable
|
9 |
+
- id: check-toml
|
10 |
+
- id: check-yaml
|
11 |
+
- id: end-of-file-fixer
|
12 |
+
- id: mixed-line-ending
|
13 |
+
args: ["--fix=lf"]
|
14 |
+
- id: requirements-txt-fixer
|
15 |
+
- id: trailing-whitespace
|
16 |
+
- repo: https://github.com/myint/docformatter
|
17 |
+
rev: v1.7.5
|
18 |
+
hooks:
|
19 |
+
- id: docformatter
|
20 |
+
args: ["--in-place"]
|
21 |
+
- repo: https://github.com/pycqa/isort
|
22 |
+
rev: 5.12.0
|
23 |
+
hooks:
|
24 |
+
- id: isort
|
25 |
+
args: ["--profile", "black"]
|
26 |
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
27 |
+
rev: v1.5.1
|
28 |
+
hooks:
|
29 |
+
- id: mypy
|
30 |
+
args: ["--ignore-missing-imports"]
|
31 |
+
additional_dependencies: ["types-python-slugify", "types-requests", "types-PyYAML"]
|
32 |
+
- repo: https://github.com/psf/black
|
33 |
+
rev: 23.7.0
|
34 |
+
hooks:
|
35 |
+
- id: black
|
36 |
+
language_version: python3.10
|
37 |
+
args: ["--line-length", "119"]
|
38 |
+
- repo: https://github.com/kynan/nbstripout
|
39 |
+
rev: 0.6.1
|
40 |
+
hooks:
|
41 |
+
- id: nbstripout
|
42 |
+
args: ["--extra-keys", "metadata.interpreter metadata.kernelspec cell.metadata.pycharm"]
|
43 |
+
- repo: https://github.com/nbQA-dev/nbQA
|
44 |
+
rev: 1.7.0
|
45 |
+
hooks:
|
46 |
+
- id: nbqa-black
|
47 |
+
- id: nbqa-pyupgrade
|
48 |
+
args: ["--py37-plus"]
|
49 |
+
- id: nbqa-isort
|
50 |
+
args: ["--float-to-top"]
|
.vscode/settings.json
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"[python]": {
|
3 |
+
"editor.defaultFormatter": "ms-python.black-formatter",
|
4 |
+
"editor.formatOnType": true,
|
5 |
+
"editor.codeActionsOnSave": {
|
6 |
+
"source.organizeImports": true
|
7 |
+
}
|
8 |
+
},
|
9 |
+
"black-formatter.args": [
|
10 |
+
"--line-length=119"
|
11 |
+
],
|
12 |
+
"isort.args": ["--profile", "black"],
|
13 |
+
"flake8.args": [
|
14 |
+
"--max-line-length=119"
|
15 |
+
],
|
16 |
+
"ruff.args": [
|
17 |
+
"--line-length=119"
|
18 |
+
],
|
19 |
+
"editor.formatOnSave": true,
|
20 |
+
"files.insertFinalNewline": true
|
21 |
+
}
|
LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2023 hysts
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
README.md
CHANGED
@@ -7,6 +7,7 @@ sdk: gradio
|
|
7 |
sdk_version: 3.42.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
7 |
sdk_version: 3.42.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
+
license: mit
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
|
3 |
+
from __future__ import annotations
|
4 |
+
|
5 |
+
import gradio as gr
|
6 |
+
|
7 |
+
from paper_list import PaperList
|
8 |
+
|
9 |
+
DESCRIPTION = "# ICCV 2023 Papers"
|
10 |
+
|
11 |
+
paper_list = PaperList()
|
12 |
+
|
13 |
+
with gr.Blocks(css="style.css") as demo:
|
14 |
+
gr.Markdown(DESCRIPTION)
|
15 |
+
|
16 |
+
search_box = gr.Textbox(
|
17 |
+
label="Search Title", placeholder="You can search for titles with regular expressions. e.g. (?<!sur)face"
|
18 |
+
)
|
19 |
+
case_sensitive = gr.Checkbox(label="Case Sensitive")
|
20 |
+
filter_names = gr.CheckboxGroup(
|
21 |
+
choices=[
|
22 |
+
"arXiv",
|
23 |
+
"GitHub",
|
24 |
+
"Space",
|
25 |
+
"Model",
|
26 |
+
"Dataset",
|
27 |
+
],
|
28 |
+
label="Filter",
|
29 |
+
)
|
30 |
+
search_button = gr.Button("Search")
|
31 |
+
|
32 |
+
number_of_papers = gr.Textbox(label="Number of Papers Found")
|
33 |
+
table = gr.HTML(show_label=False)
|
34 |
+
|
35 |
+
demo.load(
|
36 |
+
fn=paper_list.render,
|
37 |
+
inputs=[
|
38 |
+
search_box,
|
39 |
+
case_sensitive,
|
40 |
+
filter_names,
|
41 |
+
],
|
42 |
+
outputs=[
|
43 |
+
number_of_papers,
|
44 |
+
table,
|
45 |
+
],
|
46 |
+
)
|
47 |
+
|
48 |
+
search_box.submit(
|
49 |
+
fn=paper_list.render,
|
50 |
+
inputs=[
|
51 |
+
search_box,
|
52 |
+
case_sensitive,
|
53 |
+
filter_names,
|
54 |
+
],
|
55 |
+
outputs=[
|
56 |
+
number_of_papers,
|
57 |
+
table,
|
58 |
+
],
|
59 |
+
)
|
60 |
+
search_button.click(
|
61 |
+
fn=paper_list.render,
|
62 |
+
inputs=[
|
63 |
+
search_box,
|
64 |
+
case_sensitive,
|
65 |
+
filter_names,
|
66 |
+
],
|
67 |
+
outputs=[
|
68 |
+
number_of_papers,
|
69 |
+
table,
|
70 |
+
],
|
71 |
+
)
|
72 |
+
demo.queue().launch()
|
paper_list.py
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import annotations
|
2 |
+
|
3 |
+
import numpy as np
|
4 |
+
import pandas as pd
|
5 |
+
|
6 |
+
|
7 |
+
class PaperList:
|
8 |
+
def __init__(self):
|
9 |
+
self.organization_name = "ICML2023"
|
10 |
+
self.table = pd.read_csv("papers.csv")
|
11 |
+
self._preprocess_table()
|
12 |
+
|
13 |
+
self.table_header = """
|
14 |
+
<tr>
|
15 |
+
<td width="38%">Title</td>
|
16 |
+
<td width="25%">Authors</td>
|
17 |
+
<td width="5%">arXiv</td>
|
18 |
+
<td width="5%">GitHub</td>
|
19 |
+
<td width="7%">Paper pages</td>
|
20 |
+
<td width="5%">Spaces</td>
|
21 |
+
<td width="5%">Models</td>
|
22 |
+
<td width="5%">Datasets</td>
|
23 |
+
<td width="5%">Claimed</td>
|
24 |
+
</tr>"""
|
25 |
+
|
26 |
+
def _preprocess_table(self) -> None:
|
27 |
+
self.table["title_lowercase"] = self.table.title.str.lower()
|
28 |
+
|
29 |
+
rows = []
|
30 |
+
for row in self.table.itertuples():
|
31 |
+
title = f"{row.title}"
|
32 |
+
arxiv = f'<a href="{row.arxiv}" target="_blank">arXiv</a>' if isinstance(row.arxiv, str) else ""
|
33 |
+
github = f'<a href="{row.github}" target="_blank">GitHub</a>' if isinstance(row.github, str) else ""
|
34 |
+
hf_paper = (
|
35 |
+
f'<a href="{row.hf_paper}" target="_blank">Paper page</a>' if isinstance(row.hf_paper, str) else ""
|
36 |
+
)
|
37 |
+
hf_space = f'<a href="{row.hf_space}" target="_blank">Space</a>' if isinstance(row.hf_space, str) else ""
|
38 |
+
hf_model = f'<a href="{row.hf_model}" target="_blank">Model</a>' if isinstance(row.hf_model, str) else ""
|
39 |
+
hf_dataset = (
|
40 |
+
f'<a href="{row.hf_dataset}" target="_blank">Dataset</a>' if isinstance(row.hf_dataset, str) else ""
|
41 |
+
)
|
42 |
+
author_linked = "✅" if ~np.isnan(row.n_linked_authors) and row.n_linked_authors > 0 else ""
|
43 |
+
n_linked_authors = "" if np.isnan(row.n_linked_authors) else int(row.n_linked_authors)
|
44 |
+
n_authors = "" if np.isnan(row.n_authors) else int(row.n_authors)
|
45 |
+
claimed_paper = "" if n_linked_authors == "" else f"{n_linked_authors}/{n_authors} {author_linked}"
|
46 |
+
row = f"""
|
47 |
+
<tr>
|
48 |
+
<td>{title}</td>
|
49 |
+
<td>{row.authors}</td>
|
50 |
+
<td>{arxiv}</td>
|
51 |
+
<td>{github}</td>
|
52 |
+
<td>{hf_paper}</td>
|
53 |
+
<td>{hf_space}</td>
|
54 |
+
<td>{hf_model}</td>
|
55 |
+
<td>{hf_dataset}</td>
|
56 |
+
<td>{claimed_paper}</td>
|
57 |
+
</tr>"""
|
58 |
+
rows.append(row)
|
59 |
+
self.table["html_table_content"] = rows
|
60 |
+
|
61 |
+
def render(self, search_query: str, case_sensitive: bool, filter_names: list[str]) -> tuple[str, str]:
|
62 |
+
df = self.table
|
63 |
+
if search_query:
|
64 |
+
if case_sensitive:
|
65 |
+
df = df[df.title.str.contains(search_query)]
|
66 |
+
else:
|
67 |
+
df = df[df.title_lowercase.str.contains(search_query.lower())]
|
68 |
+
has_arxiv = "arXiv" in filter_names
|
69 |
+
has_github = "GitHub" in filter_names
|
70 |
+
has_hf_space = "Space" in filter_names
|
71 |
+
has_hf_model = "Model" in filter_names
|
72 |
+
has_hf_dataset = "Dataset" in filter_names
|
73 |
+
df = self.filter_table(df, has_arxiv, has_github, has_hf_space, has_hf_model, has_hf_dataset)
|
74 |
+
n_claimed = len(df[df.n_linked_authors > 0])
|
75 |
+
return f"{len(df)} ({n_claimed} claimed)", self.to_html(df, self.table_header)
|
76 |
+
|
77 |
+
@staticmethod
|
78 |
+
def filter_table(
|
79 |
+
df: pd.DataFrame,
|
80 |
+
has_arxiv: bool,
|
81 |
+
has_github: bool,
|
82 |
+
has_hf_space: bool,
|
83 |
+
has_hf_model: bool,
|
84 |
+
has_hf_dataset: bool,
|
85 |
+
) -> pd.DataFrame:
|
86 |
+
if has_arxiv:
|
87 |
+
df = df[~df.arxiv.isna()]
|
88 |
+
if has_github:
|
89 |
+
df = df[~df.github.isna()]
|
90 |
+
if has_hf_space:
|
91 |
+
df = df[~df.hf_space.isna()]
|
92 |
+
if has_hf_model:
|
93 |
+
df = df[~df.hf_model.isna()]
|
94 |
+
if has_hf_dataset:
|
95 |
+
df = df[~df.hf_dataset.isna()]
|
96 |
+
return df
|
97 |
+
|
98 |
+
@staticmethod
|
99 |
+
def to_html(df: pd.DataFrame, table_header: str) -> str:
|
100 |
+
table_data = "".join(df.html_table_content)
|
101 |
+
html = f"""
|
102 |
+
<table>
|
103 |
+
{table_header}
|
104 |
+
{table_data}
|
105 |
+
</table>"""
|
106 |
+
return html
|
papers.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pandas==2.1.0
|
style.css
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
h1 {
|
2 |
+
text-align: center;
|
3 |
+
}
|
4 |
+
|
5 |
+
table a {
|
6 |
+
background-color: transparent;
|
7 |
+
color: #58a6ff;
|
8 |
+
text-decoration: none;
|
9 |
+
}
|
10 |
+
|
11 |
+
a:active,
|
12 |
+
a:hover {
|
13 |
+
outline-width: 0;
|
14 |
+
}
|
15 |
+
|
16 |
+
a:hover {
|
17 |
+
text-decoration: underline;
|
18 |
+
}
|
19 |
+
|
20 |
+
table, th, td {
|
21 |
+
border: 1px solid;
|
22 |
+
}
|
23 |
+
|
24 |
+
img#visitor-badge {
|
25 |
+
display: block;
|
26 |
+
margin: auto;
|
27 |
+
}
|