hysts HF staff commited on
Commit
76036fd
1 Parent(s): 8235d81
.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
@@ -18,13 +18,15 @@ repos:
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 +37,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 +47,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
 
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"]
 
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,18 +1,21 @@
1
  {
2
- "python.linting.enabled": true,
3
- "python.linting.flake8Enabled": true,
4
- "python.linting.pylintEnabled": false,
5
- "python.linting.lintOnSave": true,
6
- "python.formatting.provider": "yapf",
7
- "python.formatting.yapfArgs": [
8
- "--style={based_on_style: pep8, indent_width: 4, blank_line_before_nested_class_or_def: false, spaces_before_comment: 2, split_before_logical_operator: true}"
9
- ],
10
  "[python]": {
 
11
  "editor.formatOnType": true,
12
  "editor.codeActionsOnSave": {
13
- "source.organizeImports": true
 
14
  }
15
  },
16
- "editor.formatOnSave": true,
17
- "files.insertFinalNewline": true
 
 
 
 
 
 
 
18
  }
 
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: green
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 4.36.1
8
  app_file: app.py
9
  pinned: true
10
  duplicated_from: ICML2022/ICML2022_papers
 
4
  colorFrom: green
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 5.9.1
8
  app_file: app.py
9
  pinned: true
10
  duplicated_from: ICML2022/ICML2022_papers
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
@@ -10,7 +8,7 @@ DESCRIPTION = "# ICML 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(
@@ -45,19 +43,8 @@ with gr.Blocks(css="style.css") as demo:
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,
@@ -69,4 +56,7 @@ with gr.Blocks(css="style.css") as demo:
69
  table,
70
  ],
71
  )
72
- demo.queue().launch()
 
 
 
 
1
  #!/usr/bin/env python
2
 
 
 
3
  import gradio as gr
4
 
5
  from paper_list import PaperList
 
8
 
9
  paper_list = PaperList()
10
 
11
+ with gr.Blocks(css_paths="style.css") as demo:
12
  gr.Markdown(DESCRIPTION)
13
 
14
  search_box = gr.Textbox(
 
43
  ],
44
  )
45
 
46
+ gr.on(
47
+ triggers=[search_box.submit, search_button.click],
 
 
 
 
 
 
 
 
 
 
 
48
  fn=paper_list.render,
49
  inputs=[
50
  search_box,
 
56
  table,
57
  ],
58
  )
59
+
60
+
61
+ if __name__ == "__main__":
62
+ demo.queue().launch()
paper_list.py CHANGED
@@ -1,11 +1,9 @@
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()
@@ -43,7 +41,7 @@ class PaperList:
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>
@@ -55,7 +53,7 @@ class PaperList:
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]:
@@ -98,9 +96,8 @@ class PaperList:
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
 
 
 
1
  import numpy as np
2
  import pandas as pd
3
 
4
 
5
  class PaperList:
6
+ def __init__(self) -> None:
7
  self.organization_name = "ICML2023"
8
  self.table = pd.read_csv("papers.csv")
9
  self._preprocess_table()
 
41
  n_linked_authors = "" if np.isnan(row.n_linked_authors) else int(row.n_linked_authors)
42
  n_authors = "" if np.isnan(row.n_authors) else int(row.n_authors)
43
  claimed_paper = "" if n_linked_authors == "" else f"{n_linked_authors}/{n_authors} {author_linked}"
44
+ new_row = f"""
45
  <tr>
46
  <td>{title}</td>
47
  <td>{row.authors}</td>
 
53
  <td>{hf_dataset}</td>
54
  <td>{claimed_paper}</td>
55
  </tr>"""
56
+ rows.append(new_row)
57
  self.table["html_table_content"] = rows
58
 
59
  def render(self, search_query: str, case_sensitive: bool, filter_names: list[str]) -> tuple[str, str]:
 
96
  @staticmethod
97
  def to_html(df: pd.DataFrame, table_header: str) -> str:
98
  table_data = "".join(df.html_table_content)
99
+ return f"""
100
  <table>
101
  {table_header}
102
  {table_data}
103
  </table>"""
 
pyproject.toml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "icml2023-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 icml2023-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