hysts HF staff commited on
Commit
750ddf0
1 Parent(s): c69bf2d
Files changed (7) hide show
  1. .gitattributes +1 -0
  2. .pre-commit-config.yaml +35 -0
  3. .style.yapf +5 -0
  4. app.py +26 -0
  5. papers.csv +3 -0
  6. papers.py +49 -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,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ from __future__ import annotations
4
+
5
+ import gradio as gr
6
+
7
+ from papers import PaperList
8
+
9
+ DESCRIPTION = '# CVPR 2022 papers'
10
+ FOOTER = '<img id="visitor-badge" alt="visitor badge" src="https://visitor-badge.glitch.me/badge?page_id=hysts.cvpr2022_papers" />'
11
+
12
+
13
+ def main():
14
+ paper_list = PaperList()
15
+ html_text = paper_list.to_html(paper_list.table)
16
+
17
+ with gr.Blocks(css='style.css') as demo:
18
+ gr.Markdown(DESCRIPTION)
19
+ table = gr.HTML(html_text, show_label=False)
20
+ gr.Markdown(FOOTER)
21
+
22
+ demo.launch(enable_queue=True, share=False)
23
+
24
+
25
+ if __name__ == '__main__':
26
+ main()
papers.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c993df2f9098625c9a65146ff5dd4d067954bf0634ec39af63b247304b9f1cd
3
+ size 1139113
papers.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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').fillna('')
9
+ self.table_header = '''
10
+ <tr>
11
+ <td width="50%">Paper</td>
12
+ <td width="25%">Authors</td>
13
+ <td width="5%">pdf</td>
14
+ <td width="5%">Supplementary</td>
15
+ <td width="5%">arXiv</td>
16
+ <td width="5%">GitHub</td>
17
+ <td width="5%">Hugging Face Spaces</td>
18
+ </tr>'''
19
+
20
+ def to_html(self, df: pd.DataFrame) -> str:
21
+ table_rows = self.generate_table_rows(df)
22
+ table_data = ''.join(table_rows)
23
+ html = f'''<table>
24
+ {self.table_header}
25
+ {table_data}
26
+ </table>'''
27
+ return html
28
+
29
+ def generate_table_rows(self, df: pd.DataFrame) -> list[str]:
30
+ rows = []
31
+ for row in df.itertuples():
32
+ paper = f'<a href="{row.url}">{row.title}</a>'
33
+ pdf = f'<a href="{row.pdf}">pdf</a>'
34
+ supp = f'<a href="{row.supp}">supp</a>' if row.supp else ''
35
+ arxiv = f'<a href="{row.arxiv}">arXiv</a>' if row.arxiv else ''
36
+ github = f'<a href="{row.github}">GitHub</a>' if row.github else ''
37
+ hf_space = f'<a href="{row.hf_space}">Space</a>' if row.hf_space else ''
38
+ row = f'''
39
+ <tr>
40
+ <td>{paper}</td>
41
+ <td>{row.authors}</td>
42
+ <td>{pdf}</td>
43
+ <td>{supp}</td>
44
+ <td>{arxiv}</td>
45
+ <td>{github}</td>
46
+ <td>{hf_space}</td>
47
+ </tr>'''
48
+ rows.append(row)
49
+ return rows
style.css ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ h1 {
2
+ text-align: center;
3
+ }
4
+ a {
5
+ background-color: transparent;
6
+ color: blue;
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
+ }