hysts HF staff commited on
Commit
94117f9
·
1 Parent(s): 854c1c5
.pre-commit-config.yaml CHANGED
@@ -1,6 +1,6 @@
1
  repos:
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
- rev: v4.6.0
4
  hooks:
5
  - id: check-executables-have-shebangs
6
  - id: check-json
@@ -13,18 +13,15 @@ repos:
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.13.2
23
- hooks:
24
- - id: isort
25
- args: ["--profile", "black"]
26
  - repo: https://github.com/pre-commit/mirrors-mypy
27
- rev: v1.10.0
28
  hooks:
29
  - id: mypy
30
  args: ["--ignore-missing-imports"]
@@ -35,14 +32,8 @@ repos:
35
  "types-PyYAML",
36
  "types-pytz",
37
  ]
38
- - repo: https://github.com/psf/black
39
- rev: 24.4.2
40
- hooks:
41
- - id: black
42
- language_version: python3.10
43
- args: ["--line-length", "119"]
44
  - repo: https://github.com/kynan/nbstripout
45
- rev: 0.7.1
46
  hooks:
47
  - id: nbstripout
48
  args:
@@ -51,7 +42,7 @@ repos:
51
  "metadata.interpreter metadata.kernelspec cell.metadata.pycharm",
52
  ]
53
  - repo: https://github.com/nbQA-dev/nbQA
54
- rev: 1.8.5
55
  hooks:
56
  - id: nbqa-black
57
  - id: nbqa-pyupgrade
 
1
  repos:
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
  hooks:
5
  - id: check-executables-have-shebangs
6
  - id: check-json
 
13
  args: ["--fix=lf"]
14
  - id: requirements-txt-fixer
15
  - id: trailing-whitespace
16
+ - repo: https://github.com/astral-sh/ruff-pre-commit
17
+ rev: v0.8.4
18
  hooks:
19
+ - id: ruff
20
+ args: ["--fix"]
21
+ - id: ruff-format
22
+ args: ["--line-length", "119"]
 
 
 
23
  - repo: https://github.com/pre-commit/mirrors-mypy
24
+ rev: v1.14.0
25
  hooks:
26
  - id: mypy
27
  args: ["--ignore-missing-imports"]
 
32
  "types-PyYAML",
33
  "types-pytz",
34
  ]
 
 
 
 
 
 
35
  - repo: https://github.com/kynan/nbstripout
36
+ rev: 0.8.1
37
  hooks:
38
  - id: nbstripout
39
  args:
 
42
  "metadata.interpreter metadata.kernelspec cell.metadata.pycharm",
43
  ]
44
  - repo: https://github.com/nbQA-dev/nbQA
45
+ rev: 1.9.1
46
  hooks:
47
  - id: nbqa-black
48
  - id: nbqa-pyupgrade
.python-version ADDED
@@ -0,0 +1 @@
 
 
1
+ 3.10
.vscode/extensions.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recommendations": [
3
+ "ms-python.python",
4
+ "charliermarsh.ruff",
5
+ "streetsidesoftware.code-spell-checker",
6
+ "tamasfe.even-better-toml"
7
+ ]
8
+ }
.vscode/settings.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "files.insertFinalNewline": false,
4
+ "[python]": {
5
+ "editor.defaultFormatter": "charliermarsh.ruff",
6
+ "editor.formatOnType": true,
7
+ "editor.codeActionsOnSave": {
8
+ "source.fixAll.ruff": "explicit",
9
+ "source.organizeImports": "explicit"
10
+ }
11
+ },
12
+ "[jupyter]": {
13
+ "files.insertFinalNewline": false
14
+ },
15
+ "notebook.output.scrolling": true,
16
+ "notebook.formatOnCellExecution": true,
17
+ "notebook.formatOnSave.enabled": true,
18
+ "notebook.codeActionsOnSave": {
19
+ "source.organizeImports": "explicit"
20
+ }
21
+ }
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🔥
4
  colorFrom: red
5
  colorTo: green
6
  sdk: gradio
7
- sdk_version: 4.36.1
8
  app_file: app.py
9
  pinned: true
10
  ---
 
4
  colorFrom: red
5
  colorTo: green
6
  sdk: gradio
7
+ sdk_version: 5.9.1
8
  app_file: app.py
9
  pinned: true
10
  ---
app.py CHANGED
@@ -1,7 +1,5 @@
1
  #!/usr/bin/env python
2
 
3
- from __future__ import annotations
4
-
5
  import gradio as gr
6
 
7
  from paper_list import PaperList
@@ -14,7 +12,7 @@ NOTES = """
14
 
15
  paper_list = PaperList()
16
 
17
- with gr.Blocks(css="style.css") as demo:
18
  gr.Markdown(DESCRIPTION)
19
 
20
  search_box = gr.Textbox(
@@ -63,4 +61,6 @@ with gr.Blocks(css="style.css") as demo:
63
  table,
64
  ],
65
  )
66
- demo.queue().launch()
 
 
 
1
  #!/usr/bin/env python
2
 
 
 
3
  import gradio as gr
4
 
5
  from paper_list import PaperList
 
12
 
13
  paper_list = PaperList()
14
 
15
+ with gr.Blocks(css_paths="style.css") as demo:
16
  gr.Markdown(DESCRIPTION)
17
 
18
  search_box = gr.Textbox(
 
61
  table,
62
  ],
63
  )
64
+
65
+ if __name__ == "__main__":
66
+ demo.queue().launch()
paper_list.py CHANGED
@@ -1,10 +1,8 @@
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
 
@@ -36,7 +34,7 @@ class PaperList:
36
  hf_dataset = (
37
  f'<a href="{row.hf_dataset}" target="_blank">Dataset</a>' if isinstance(row.hf_dataset, str) else ""
38
  )
39
- row = f"""
40
  <tr>
41
  <td>{paper}</td>
42
  <td>{row.authors}</td>
@@ -48,7 +46,7 @@ class PaperList:
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, filter_names: list[str]) -> tuple[int, str]:
@@ -94,9 +92,8 @@ class PaperList:
94
  @staticmethod
95
  def to_html(df: pd.DataFrame, table_header: str) -> str:
96
  table_data = "".join(df.html_table_content)
97
- html = f"""
98
  <table>
99
  {table_header}
100
  {table_data}
101
  </table>"""
102
- return html
 
 
 
1
  import pandas as pd
2
 
3
 
4
  class PaperList:
5
+ def __init__(self) -> None:
6
  self.table = pd.read_csv("papers.csv")
7
  self._preprcess_table()
8
 
 
34
  hf_dataset = (
35
  f'<a href="{row.hf_dataset}" target="_blank">Dataset</a>' if isinstance(row.hf_dataset, str) else ""
36
  )
37
+ new_row = f"""
38
  <tr>
39
  <td>{paper}</td>
40
  <td>{row.authors}</td>
 
46
  <td>{hf_model}</td>
47
  <td>{hf_dataset}</td>
48
  </tr>"""
49
+ rows.append(new_row)
50
  self.table["html_table_content"] = rows
51
 
52
  def render(self, search_query: str, case_sensitive: bool, filter_names: list[str]) -> tuple[int, str]:
 
92
  @staticmethod
93
  def to_html(df: pd.DataFrame, table_header: str) -> str:
94
  table_data = "".join(df.html_table_content)
95
+ return f"""
96
  <table>
97
  {table_header}
98
  {table_data}
99
  </table>"""
 
pyproject.toml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "cvpr2022-papers"
3
+ version = "0.1.0"
4
+ description = ""
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = [
8
+ "gradio>=5.9.1",
9
+ ]
10
+
11
+ [tool.ruff]
12
+ line-length = 119
13
+
14
+ [tool.ruff.lint]
15
+ select = ["ALL"]
16
+ ignore = [
17
+ "COM812", # missing-trailing-comma
18
+ "D203", # one-blank-line-before-class
19
+ "D213", # multi-line-summary-second-line
20
+ "E501", # line-too-long
21
+ "SIM117", # multiple-with-statements
22
+ ]
23
+ extend-ignore = [
24
+ "D100", # undocumented-public-module
25
+ "D101", # undocumented-public-class
26
+ "D102", # undocumented-public-method
27
+ "D103", # undocumented-public-function
28
+ "D104", # undocumented-public-package
29
+ "D105", # undocumented-magic-method
30
+ "D107", # undocumented-public-init
31
+ "EM101", # raw-string-in-exception
32
+ "FBT001", # boolean-type-hint-positional-argument
33
+ "FBT002", # boolean-default-value-positional-argument
34
+ "PD901", # pandas-df-variable-name
35
+ "PGH003", # blanket-type-ignore
36
+ "PLR0913", # too-many-arguments
37
+ "PLR0915", # too-many-statements
38
+ "TRY003", # raise-vanilla-args
39
+ ]
40
+ unfixable = [
41
+ "F401", # unused-import
42
+ ]
43
+
44
+ [tool.ruff.format]
45
+ docstring-code-format = true
requirements.txt ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file was autogenerated by uv via the following command:
2
+ # uv pip compile pyproject.toml -o requirements.txt
3
+ aiofiles==23.2.1
4
+ # via gradio
5
+ annotated-types==0.7.0
6
+ # via pydantic
7
+ anyio==4.7.0
8
+ # via
9
+ # gradio
10
+ # httpx
11
+ # starlette
12
+ certifi==2024.12.14
13
+ # via
14
+ # httpcore
15
+ # httpx
16
+ # requests
17
+ charset-normalizer==3.4.1
18
+ # via requests
19
+ click==8.1.8
20
+ # via
21
+ # typer
22
+ # uvicorn
23
+ exceptiongroup==1.2.2
24
+ # via anyio
25
+ fastapi==0.115.6
26
+ # via gradio
27
+ ffmpy==0.5.0
28
+ # via gradio
29
+ filelock==3.16.1
30
+ # via huggingface-hub
31
+ fsspec==2024.12.0
32
+ # via
33
+ # gradio-client
34
+ # huggingface-hub
35
+ gradio==5.9.1
36
+ # via cvpr2022-papers (pyproject.toml)
37
+ gradio-client==1.5.2
38
+ # via gradio
39
+ h11==0.14.0
40
+ # via
41
+ # httpcore
42
+ # uvicorn
43
+ httpcore==1.0.7
44
+ # via httpx
45
+ httpx==0.28.1
46
+ # via
47
+ # gradio
48
+ # gradio-client
49
+ # safehttpx
50
+ huggingface-hub==0.27.0
51
+ # via
52
+ # gradio
53
+ # gradio-client
54
+ idna==3.10
55
+ # via
56
+ # anyio
57
+ # httpx
58
+ # requests
59
+ jinja2==3.1.5
60
+ # via gradio
61
+ markdown-it-py==3.0.0
62
+ # via rich
63
+ markupsafe==2.1.5
64
+ # via
65
+ # gradio
66
+ # jinja2
67
+ mdurl==0.1.2
68
+ # via markdown-it-py
69
+ numpy==2.2.1
70
+ # via
71
+ # gradio
72
+ # pandas
73
+ orjson==3.10.13
74
+ # via gradio
75
+ packaging==24.2
76
+ # via
77
+ # gradio
78
+ # gradio-client
79
+ # huggingface-hub
80
+ pandas==2.2.3
81
+ # via gradio
82
+ pillow==11.1.0
83
+ # via gradio
84
+ pydantic==2.10.4
85
+ # via
86
+ # fastapi
87
+ # gradio
88
+ pydantic-core==2.27.2
89
+ # via pydantic
90
+ pydub==0.25.1
91
+ # via gradio
92
+ pygments==2.18.0
93
+ # via rich
94
+ python-dateutil==2.9.0.post0
95
+ # via pandas
96
+ python-multipart==0.0.20
97
+ # via gradio
98
+ pytz==2024.2
99
+ # via pandas
100
+ pyyaml==6.0.2
101
+ # via
102
+ # gradio
103
+ # huggingface-hub
104
+ requests==2.32.3
105
+ # via huggingface-hub
106
+ rich==13.9.4
107
+ # via typer
108
+ ruff==0.8.5
109
+ # via gradio
110
+ safehttpx==0.1.6
111
+ # via gradio
112
+ semantic-version==2.10.0
113
+ # via gradio
114
+ shellingham==1.5.4
115
+ # via typer
116
+ six==1.17.0
117
+ # via python-dateutil
118
+ sniffio==1.3.1
119
+ # via anyio
120
+ starlette==0.41.3
121
+ # via
122
+ # fastapi
123
+ # gradio
124
+ tomlkit==0.13.2
125
+ # via gradio
126
+ tqdm==4.67.1
127
+ # via huggingface-hub
128
+ typer==0.15.1
129
+ # via gradio
130
+ typing-extensions==4.12.2
131
+ # via
132
+ # anyio
133
+ # fastapi
134
+ # gradio
135
+ # gradio-client
136
+ # huggingface-hub
137
+ # pydantic
138
+ # pydantic-core
139
+ # rich
140
+ # typer
141
+ # uvicorn
142
+ tzdata==2024.2
143
+ # via pandas
144
+ urllib3==2.3.0
145
+ # via requests
146
+ uvicorn==0.34.0
147
+ # via gradio
148
+ websockets==14.1
149
+ # via gradio-client
uv.lock ADDED
The diff for this file is too large to render. See raw diff