hysts HF staff commited on
Commit
3696e1b
1 Parent(s): e610883
Files changed (7) hide show
  1. .gitattributes +1 -0
  2. .pre-commit-config.yaml +35 -0
  3. .style.yapf +5 -0
  4. app.py +70 -0
  5. paper_list.py +95 -0
  6. papers.csv +3 -0
  7. style.css +22 -0
.gitattributes CHANGED
@@ -1,3 +1,4 @@
 
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
3
  *.bin filter=lfs diff=lfs merge=lfs -text
1
+ *.csv filter=lfs diff=lfs merge=lfs -text
2
  *.7z filter=lfs diff=lfs merge=lfs -text
3
  *.arrow filter=lfs diff=lfs merge=lfs -text
4
  *.bin filter=lfs diff=lfs merge=lfs -text
.pre-commit-config.yaml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.2.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: double-quote-string-fixer
12
+ - id: end-of-file-fixer
13
+ - id: mixed-line-ending
14
+ args: ['--fix=lf']
15
+ - id: requirements-txt-fixer
16
+ - id: trailing-whitespace
17
+ - repo: https://github.com/myint/docformatter
18
+ rev: v1.4
19
+ hooks:
20
+ - id: docformatter
21
+ args: ['--in-place']
22
+ - repo: https://github.com/pycqa/isort
23
+ rev: 5.10.1
24
+ hooks:
25
+ - id: isort
26
+ - repo: https://github.com/pre-commit/mirrors-mypy
27
+ rev: v0.812
28
+ hooks:
29
+ - id: mypy
30
+ args: ['--ignore-missing-imports']
31
+ - repo: https://github.com/google/yapf
32
+ rev: v0.32.0
33
+ hooks:
34
+ - id: yapf
35
+ args: ['--parallel', '--in-place']
.style.yapf ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ [style]
2
+ based_on_style = pep8
3
+ blank_line_before_nested_class_or_def = false
4
+ spaces_before_comment = 2
5
+ split_before_logical_operator = true
app.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = '# ICML 2022 Papers'
10
+ NOTES = '''
11
+ - [ICML 2022](https://icml.cc/Conferences/2022/)
12
+ - [Proceedings](https://proceedings.mlr.press/v162/)
13
+ '''
14
+ FOOTER = '<img id="visitor-badge" alt="visitor badge" src="https://visitor-badge.glitch.me/badge?page_id=hysts.icml2022_papers" />'
15
+
16
+
17
+ def main():
18
+ paper_list = PaperList()
19
+
20
+ with gr.Blocks(css='style.css') as demo:
21
+ gr.Markdown(DESCRIPTION)
22
+
23
+ search_box = gr.Textbox(
24
+ label='Search Title',
25
+ placeholder=
26
+ 'You can search for titles with regular expressions. e.g. (?<!sur)face'
27
+ )
28
+ case_sensitive = gr.Checkbox(label='Case Sensitive')
29
+ filter_names = gr.CheckboxGroup(choices=[
30
+ 'arXiv',
31
+ 'GitHub',
32
+ 'HF Space',
33
+ 'HF Model',
34
+ 'HF Dataset',
35
+ ],
36
+ label='Filter')
37
+ search_button = gr.Button('Search')
38
+
39
+ number_of_papers = gr.Textbox(label='Number of Papers Found')
40
+ table = gr.HTML(show_label=False)
41
+
42
+ gr.Markdown(NOTES)
43
+ gr.Markdown(FOOTER)
44
+
45
+ demo.load(paper_list.render,
46
+ inputs=[
47
+ search_box,
48
+ case_sensitive,
49
+ filter_names,
50
+ ],
51
+ outputs=[
52
+ number_of_papers,
53
+ table,
54
+ ])
55
+ search_button.click(paper_list.render,
56
+ inputs=[
57
+ search_box,
58
+ case_sensitive,
59
+ filter_names,
60
+ ],
61
+ outputs=[
62
+ number_of_papers,
63
+ table,
64
+ ])
65
+
66
+ demo.launch(enable_queue=True, share=False)
67
+
68
+
69
+ if __name__ == '__main__':
70
+ main()
paper_list.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import pandas as pd
4
+
5
+
6
+ class PaperList:
7
+ def __init__(self):
8
+ self.table = pd.read_csv('papers.csv')
9
+ self._preprcess_table()
10
+
11
+ self.table_header = '''
12
+ <tr>
13
+ <td width="50%">Paper</td>
14
+ <td width="26%">Authors</td>
15
+ <td width="4%">pdf</td>
16
+ <td width="4%">arXiv</td>
17
+ <td width="4%">GitHub</td>
18
+ <td width="4%">HF Spaces</td>
19
+ <td width="4%">HF Models</td>
20
+ <td width="4%">HF Datasets</td>
21
+ </tr>'''
22
+
23
+ def _preprcess_table(self) -> None:
24
+ self.table['title_lowercase'] = self.table.title.str.lower()
25
+
26
+ rows = []
27
+ for row in self.table.itertuples():
28
+ paper = f'<a href="{row.url}" target="_blank">{row.title}</a>'
29
+ pdf = f'<a href="{row.pdf}" target="_blank">pdf</a>'
30
+ arxiv = f'<a href="{row.arxiv}" target="_blank">arXiv</a>' if isinstance(
31
+ row.arxiv, str) else ''
32
+ github = f'<a href="{row.github}" target="_blank">GitHub</a>' if isinstance(
33
+ row.github, str) else ''
34
+ hf_space = f'<a href="{row.hf_space}" target="_blank">Space</a>' if isinstance(
35
+ row.hf_space, str) else ''
36
+ hf_model = f'<a href="{row.hf_model}" target="_blank">Model</a>' if isinstance(
37
+ row.hf_model, str) else ''
38
+ hf_dataset = f'<a href="{row.hf_dataset}" target="_blank">Dataset</a>' if isinstance(
39
+ row.hf_dataset, str) else ''
40
+ row = f'''
41
+ <tr>
42
+ <td>{paper}</td>
43
+ <td>{row.authors}</td>
44
+ <td>{pdf}</td>
45
+ <td>{arxiv}</td>
46
+ <td>{github}</td>
47
+ <td>{hf_space}</td>
48
+ <td>{hf_model}</td>
49
+ <td>{hf_dataset}</td>
50
+ </tr>'''
51
+ rows.append(row)
52
+ self.table['html_table_content'] = rows
53
+
54
+ def render(self, search_query: str, case_sensitive: bool,
55
+ filter_names: list[str]) -> tuple[int, str]:
56
+ df = self.table
57
+ if search_query:
58
+ if case_sensitive:
59
+ df = df[df.title.str.contains(search_query)]
60
+ else:
61
+ df = df[df.title_lowercase.str.contains(search_query.lower())]
62
+ has_arxiv = 'arXiv' in filter_names
63
+ has_github = 'GitHub' in filter_names
64
+ has_hf_space = 'HF Space' in filter_names
65
+ has_hf_model = 'HF Model' in filter_names
66
+ has_hf_dataset = 'HF Dataset' in filter_names
67
+ df = self.filter_table(df, has_arxiv, has_github, has_hf_space,
68
+ has_hf_model, has_hf_dataset)
69
+ return len(df), self.to_html(df, self.table_header)
70
+
71
+ @staticmethod
72
+ def filter_table(df: pd.DataFrame, has_arxiv: bool, has_github: bool,
73
+ has_hf_space: bool, has_hf_model: bool,
74
+ has_hf_dataset: bool) -> pd.DataFrame:
75
+ if has_arxiv:
76
+ df = df[~df.arxiv.isna()]
77
+ if has_github:
78
+ df = df[~df.github.isna()]
79
+ if has_hf_space:
80
+ df = df[~df.hf_space.isna()]
81
+ if has_hf_model:
82
+ df = df[~df.hf_model.isna()]
83
+ if has_hf_dataset:
84
+ df = df[~df.hf_dataset.isna()]
85
+ return df
86
+
87
+ @staticmethod
88
+ def to_html(df: pd.DataFrame, table_header: str) -> str:
89
+ table_data = ''.join(df.html_table_content)
90
+ html = f'''
91
+ <table>
92
+ {table_header}
93
+ {table_data}
94
+ </table>'''
95
+ return html
papers.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad4cd39ae06510d183ac2bd45307062aa284d9f4b376cfc0f737d150825a4a38
3
+ size 335337
style.css ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ h1 {
2
+ text-align: center;
3
+ }
4
+ table a {
5
+ background-color: transparent;
6
+ color: #58a6ff;
7
+ text-decoration: none;
8
+ }
9
+ a:active,
10
+ a:hover {
11
+ outline-width: 0;
12
+ }
13
+ a:hover {
14
+ text-decoration: underline;
15
+ }
16
+ table, th, td {
17
+ border: 1px solid;
18
+ }
19
+ img#visitor-badge {
20
+ display: block;
21
+ margin: auto;
22
+ }