hysts HF staff commited on
Commit
1dfbccd
·
1 Parent(s): cc91d5f
.pre-commit-config.yaml CHANGED
@@ -1,6 +1,6 @@
1
  repos:
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
- rev: v4.5.0
4
  hooks:
5
  - id: check-executables-have-shebangs
6
  - id: check-json
@@ -18,26 +18,27 @@ repos:
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.6.0
28
  hooks:
29
  - id: mypy
30
  args: ["--ignore-missing-imports"]
31
  additional_dependencies:
32
- ["types-python-slugify", "types-requests", "types-PyYAML"]
33
- - repo: https://github.com/psf/black
34
- rev: 23.9.1
35
- hooks:
36
- - id: black
37
- language_version: python3.10
38
- args: ["--line-length", "119"]
39
  - repo: https://github.com/kynan/nbstripout
40
- rev: 0.6.1
41
  hooks:
42
  - id: nbstripout
43
  args:
@@ -46,7 +47,7 @@ repos:
46
  "metadata.interpreter metadata.kernelspec cell.metadata.pycharm",
47
  ]
48
  - repo: https://github.com/nbQA-dev/nbQA
49
- rev: 1.7.0
50
  hooks:
51
  - id: nbqa-black
52
  - 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
 
18
  hooks:
19
  - id: docformatter
20
  args: ["--in-place"]
21
+ - repo: https://github.com/astral-sh/ruff-pre-commit
22
+ rev: v0.8.4
23
  hooks:
24
+ - id: ruff
25
+ args: ["--fix"]
26
+ - id: ruff-format
27
+ args: ["--line-length", "119"]
28
  - repo: https://github.com/pre-commit/mirrors-mypy
29
+ rev: v1.14.0
30
  hooks:
31
  - id: mypy
32
  args: ["--ignore-missing-imports"]
33
  additional_dependencies:
34
+ [
35
+ "types-python-slugify",
36
+ "types-requests",
37
+ "types-PyYAML",
38
+ "types-pytz",
39
+ ]
 
40
  - repo: https://github.com/kynan/nbstripout
41
+ rev: 0.8.1
42
  hooks:
43
  - id: nbstripout
44
  args:
 
47
  "metadata.interpreter metadata.kernelspec cell.metadata.pycharm",
48
  ]
49
  - repo: https://github.com/nbQA-dev/nbQA
50
+ rev: 1.9.1
51
  hooks:
52
  - id: nbqa-black
53
  - 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 CHANGED
@@ -1,21 +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
  }
 
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: gray
5
  colorTo: red
6
  sdk: gradio
7
- sdk_version: 4.36.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: gray
5
  colorTo: red
6
  sdk: gradio
7
+ sdk_version: 5.9.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
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
@@ -38,7 +36,7 @@ If your paper is not yet indexed on huggingface, you can index it by following t
38
 
39
  paper_list = PaperList()
40
 
41
- with gr.Blocks(css="style.css") as demo:
42
  gr.Markdown(DESCRIPTION)
43
  with gr.Accordion(label="Tutorial", open=True):
44
  gr.Markdown(TUTORIAL)
 
1
  #!/usr/bin/env python
2
 
 
 
3
  import gradio as gr
4
 
5
  from paper_list import PaperList
 
36
 
37
  paper_list = PaperList()
38
 
39
+ with gr.Blocks(css_paths="style.css") as demo:
40
  gr.Markdown(DESCRIPTION)
41
  with gr.Accordion(label="Tutorial", open=True):
42
  gr.Markdown(TUTORIAL)
paper_list.py CHANGED
@@ -1,15 +1,13 @@
1
- from __future__ import annotations
2
-
3
  import pandas as pd
4
 
5
 
6
  class PaperList:
7
- def __init__(self):
8
  self.organization_name = "ICML2023"
9
  self.table = pd.read_json("papers.json").fillna("")
10
 
11
  claim_info = pd.read_csv("claim_info.csv", dtype={"arxiv_id": str, "n_authors": int, "n_linked_authors": int})
12
- self.table = pd.merge(self.table, claim_info, on="arxiv_id", how="left")
13
  self.table[["n_authors", "n_linked_authors"]] = (
14
  self.table[["n_authors", "n_linked_authors"]].fillna(-1).astype(int)
15
  )
@@ -49,7 +47,7 @@ class PaperList:
49
  n_linked_authors = "" if row.n_linked_authors == -1 else row.n_linked_authors
50
  n_authors = "" if row.n_authors == -1 else row.n_authors
51
  claimed_paper = "" if n_linked_authors == "" else f"{n_linked_authors}/{n_authors} {author_linked}"
52
- row = f"""
53
  <tr>
54
  <td>{title}</td>
55
  <td>{row.authors}</td>
@@ -62,7 +60,7 @@ class PaperList:
62
  <td>{hf_dataset}</td>
63
  <td>{claimed_paper}</td>
64
  </tr>"""
65
- rows.append(row)
66
  self.table["html_table_content"] = rows
67
 
68
  def render(
@@ -113,9 +111,8 @@ class PaperList:
113
  @staticmethod
114
  def to_html(df: pd.DataFrame, table_header: str) -> str:
115
  table_data = "".join(df.html_table_content)
116
- html = f"""
117
  <table>
118
  {table_header}
119
  {table_data}
120
  </table>"""
121
- return html
 
 
 
1
  import pandas as pd
2
 
3
 
4
  class PaperList:
5
+ def __init__(self) -> None:
6
  self.organization_name = "ICML2023"
7
  self.table = pd.read_json("papers.json").fillna("")
8
 
9
  claim_info = pd.read_csv("claim_info.csv", dtype={"arxiv_id": str, "n_authors": int, "n_linked_authors": int})
10
+ self.table = self.table.merge(right=claim_info, on="arxiv_id", how="left")
11
  self.table[["n_authors", "n_linked_authors"]] = (
12
  self.table[["n_authors", "n_linked_authors"]].fillna(-1).astype(int)
13
  )
 
47
  n_linked_authors = "" if row.n_linked_authors == -1 else row.n_linked_authors
48
  n_authors = "" if row.n_authors == -1 else row.n_authors
49
  claimed_paper = "" if n_linked_authors == "" else f"{n_linked_authors}/{n_authors} {author_linked}"
50
+ new_row = f"""
51
  <tr>
52
  <td>{title}</td>
53
  <td>{row.authors}</td>
 
60
  <td>{hf_dataset}</td>
61
  <td>{claimed_paper}</td>
62
  </tr>"""
63
+ rows.append(new_row)
64
  self.table["html_table_content"] = rows
65
 
66
  def render(
 
111
  @staticmethod
112
  def to_html(df: pd.DataFrame, table_header: str) -> str:
113
  table_data = "".join(df.html_table_content)
114
+ return f"""
115
  <table>
116
  {table_header}
117
  {table_data}
118
  </table>"""
 
pyproject.toml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "iccv2023-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 CHANGED
@@ -1 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  pandas==2.2.2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 iccv2023-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.2
81
+ # via gradio
82
+ pillow==11.0.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.4
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