hayas commited on
Commit
a8099ce
·
1 Parent(s): 910a1c2
.pre-commit-config.yaml CHANGED
@@ -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.12.0
28
  hooks:
29
  - id: mypy
30
  args: ["--ignore-missing-imports"]
@@ -35,18 +32,8 @@ repos:
35
  "types-PyYAML",
36
  "types-pytz",
37
  ]
38
- - repo: https://github.com/psf/black
39
- rev: 24.10.0
40
- hooks:
41
- - id: black
42
- language_version: python3.10
43
- args: ["--line-length", "119"]
44
- - repo: https://github.com/charliermarsh/ruff-pre-commit
45
- rev: v0.7.0
46
- hooks:
47
- - id: ruff
48
  - repo: https://github.com/kynan/nbstripout
49
- rev: 0.7.1
50
  hooks:
51
  - id: nbstripout
52
  args:
@@ -55,7 +42,7 @@ repos:
55
  "metadata.interpreter metadata.kernelspec cell.metadata.pycharm",
56
  ]
57
  - repo: https://github.com/nbQA-dev/nbQA
58
- rev: 1.8.7
59
  hooks:
60
  - id: nbqa-black
61
  - id: nbqa-pyupgrade
 
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
.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
@@ -2,29 +2,20 @@
2
  "editor.formatOnSave": true,
3
  "files.insertFinalNewline": false,
4
  "[python]": {
5
- "editor.defaultFormatter": "ms-python.black-formatter",
6
  "editor.formatOnType": true,
7
  "editor.codeActionsOnSave": {
 
8
  "source.organizeImports": "explicit"
9
  }
10
  },
11
  "[jupyter]": {
12
  "files.insertFinalNewline": false
13
  },
14
- "black-formatter.args": [
15
- "--line-length=119"
16
- ],
17
- "isort.args": ["--profile", "black"],
18
- "flake8.args": [
19
- "--max-line-length=119"
20
- ],
21
- "ruff.lint.args": [
22
- "--line-length=119"
23
- ],
24
  "notebook.output.scrolling": true,
25
  "notebook.formatOnCellExecution": true,
26
  "notebook.formatOnSave.enabled": true,
27
- "notebook.codeActionsOnSave": {
28
- "source.organizeImports": "explicit"
29
- }
30
  }
 
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: purple
6
  sdk: gradio
7
- sdk_version: 5.1.0
8
  app_file: app.py
9
  license: mit
10
  ---
 
4
  colorFrom: red
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 5.9.1
8
  app_file: app.py
9
  license: mit
10
  ---
app.py CHANGED
@@ -78,10 +78,13 @@ def update_subject(
78
  return (
79
  gr.Textbox(value=len(ds[subject])), # Number of Questions
80
  gr.Slider(label="Question Index", minimum=0, maximum=len(ds[subject]) - 1, step=1, value=0), # Question Index
81
- ) + update_question(subject, 0)
 
82
 
83
 
84
- def update_question(subject: str, question_index: int) -> tuple[
 
 
85
  gr.Gallery, # Images
86
  gr.Textbox, # Question
87
  gr.Textbox, # Options
 
78
  return (
79
  gr.Textbox(value=len(ds[subject])), # Number of Questions
80
  gr.Slider(label="Question Index", minimum=0, maximum=len(ds[subject]) - 1, step=1, value=0), # Question Index
81
+ *update_question(subject, 0),
82
+ )
83
 
84
 
85
+ def update_question(
86
+ subject: str, question_index: int
87
+ ) -> tuple[
88
  gr.Gallery, # Images
89
  gr.Textbox, # Question
90
  gr.Textbox, # Options
pyproject.toml CHANGED
@@ -4,4 +4,44 @@ version = "0.1.0"
4
  description = ""
5
  readme = "README.md"
6
  requires-python = ">=3.10"
7
- dependencies = ["datasets>=3.0.1", "gradio>=5.1.0", "hf-transfer>=0.1.8"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  description = ""
5
  readme = "README.md"
6
  requires-python = ">=3.10"
7
+ dependencies = [
8
+ "datasets>=3.2.0",
9
+ "gradio>=5.9.1",
10
+ "hf-transfer>=0.1.8",
11
+ ]
12
+
13
+ [tool.ruff]
14
+ line-length = 119
15
+
16
+ [tool.ruff.lint]
17
+ select = ["ALL"]
18
+ ignore = [
19
+ "COM812", # missing-trailing-comma
20
+ "D203", # one-blank-line-before-class
21
+ "D213", # multi-line-summary-second-line
22
+ "E501", # line-too-long
23
+ "SIM117", # multiple-with-statements
24
+ ]
25
+ extend-ignore = [
26
+ "D100", # undocumented-public-module
27
+ "D101", # undocumented-public-class
28
+ "D102", # undocumented-public-method
29
+ "D103", # undocumented-public-function
30
+ "D104", # undocumented-public-package
31
+ "D105", # undocumented-magic-method
32
+ "D107", # undocumented-public-init
33
+ "EM101", # raw-string-in-exception
34
+ "FBT001", # boolean-type-hint-positional-argument
35
+ "FBT002", # boolean-default-value-positional-argument
36
+ "PD901", # pandas-df-variable-name
37
+ "PGH003", # blanket-type-ignore
38
+ "PLR0913", # too-many-arguments
39
+ "PLR0915", # too-many-statements
40
+ "TRY003", # raise-vanilla-args
41
+ ]
42
+ unfixable = [
43
+ "F401", # unused-import
44
+ ]
45
+
46
+ [tool.ruff.format]
47
+ docstring-code-format = true
requirements.txt CHANGED
@@ -2,37 +2,37 @@
2
  # uv pip compile pyproject.toml -o requirements.txt
3
  aiofiles==23.2.1
4
  # via gradio
5
- aiohappyeyeballs==2.4.3
6
  # via aiohttp
7
- aiohttp==3.10.8
8
  # via
9
  # datasets
10
  # fsspec
11
- aiosignal==1.3.1
12
  # via aiohttp
13
  annotated-types==0.7.0
14
  # via pydantic
15
- anyio==4.6.0
16
  # via
17
  # gradio
18
  # httpx
19
  # starlette
20
- async-timeout==4.0.3
21
  # via aiohttp
22
- attrs==24.2.0
23
  # via aiohttp
24
- certifi==2024.8.30
25
  # via
26
  # httpcore
27
  # httpx
28
  # requests
29
- charset-normalizer==3.3.2
30
  # via requests
31
- click==8.1.7
32
  # via
33
  # typer
34
  # uvicorn
35
- datasets==3.0.1
36
  # via jmmmu-dataset-viewer (pyproject.toml)
37
  dill==0.3.8
38
  # via
@@ -40,26 +40,26 @@ dill==0.3.8
40
  # multiprocess
41
  exceptiongroup==1.2.2
42
  # via anyio
43
- fastapi==0.115.0
44
  # via gradio
45
- ffmpy==0.4.0
46
  # via gradio
47
  filelock==3.16.1
48
  # via
49
  # datasets
50
  # huggingface-hub
51
- frozenlist==1.4.1
52
  # via
53
  # aiohttp
54
  # aiosignal
55
- fsspec==2024.6.1
56
  # via
57
  # datasets
58
  # gradio-client
59
  # huggingface-hub
60
- gradio==5.1.0
61
  # via jmmmu-dataset-viewer (pyproject.toml)
62
- gradio-client==1.4.0
63
  # via gradio
64
  h11==0.14.0
65
  # via
@@ -67,13 +67,14 @@ h11==0.14.0
67
  # uvicorn
68
  hf-transfer==0.1.8
69
  # via jmmmu-dataset-viewer (pyproject.toml)
70
- httpcore==1.0.6
71
  # via httpx
72
- httpx==0.27.2
73
  # via
74
  # gradio
75
  # gradio-client
76
- huggingface-hub==0.25.1
 
77
  # via
78
  # datasets
79
  # gradio
@@ -84,7 +85,7 @@ idna==3.10
84
  # httpx
85
  # requests
86
  # yarl
87
- jinja2==3.1.4
88
  # via gradio
89
  markdown-it-py==3.0.0
90
  # via rich
@@ -100,15 +101,14 @@ multidict==6.1.0
100
  # yarl
101
  multiprocess==0.70.16
102
  # via datasets
103
- numpy==2.1.1
104
  # via
105
  # datasets
106
  # gradio
107
  # pandas
108
- # pyarrow
109
- orjson==3.10.7
110
  # via gradio
111
- packaging==24.1
112
  # via
113
  # datasets
114
  # gradio
@@ -118,15 +118,19 @@ pandas==2.2.3
118
  # via
119
  # datasets
120
  # gradio
121
- pillow==10.4.0
122
  # via gradio
123
- pyarrow==17.0.0
 
 
 
 
124
  # via datasets
125
- pydantic==2.9.2
126
  # via
127
  # fastapi
128
  # gradio
129
- pydantic-core==2.23.4
130
  # via pydantic
131
  pydub==0.25.1
132
  # via gradio
@@ -134,7 +138,7 @@ pygments==2.18.0
134
  # via rich
135
  python-dateutil==2.9.0.post0
136
  # via pandas
137
- python-multipart==0.0.12
138
  # via gradio
139
  pytz==2024.2
140
  # via pandas
@@ -147,29 +151,31 @@ requests==2.32.3
147
  # via
148
  # datasets
149
  # huggingface-hub
150
- rich==13.9.1
151
  # via typer
152
- ruff==0.6.8
 
 
153
  # via gradio
154
  semantic-version==2.10.0
155
  # via gradio
156
  shellingham==1.5.4
157
  # via typer
158
- six==1.16.0
159
  # via python-dateutil
160
  sniffio==1.3.1
 
 
161
  # via
162
- # anyio
163
- # httpx
164
- starlette==0.38.6
165
- # via fastapi
166
- tomlkit==0.12.0
167
  # via gradio
168
- tqdm==4.66.5
169
  # via
170
  # datasets
171
  # huggingface-hub
172
- typer==0.12.5
173
  # via gradio
174
  typing-extensions==4.12.2
175
  # via
@@ -186,13 +192,13 @@ typing-extensions==4.12.2
186
  # uvicorn
187
  tzdata==2024.2
188
  # via pandas
189
- urllib3==2.2.3
190
  # via requests
191
- uvicorn==0.31.0
192
  # via gradio
193
- websockets==12.0
194
  # via gradio-client
195
  xxhash==3.5.0
196
  # via datasets
197
- yarl==1.13.1
198
  # via aiohttp
 
2
  # uv pip compile pyproject.toml -o requirements.txt
3
  aiofiles==23.2.1
4
  # via gradio
5
+ aiohappyeyeballs==2.4.4
6
  # via aiohttp
7
+ aiohttp==3.11.11
8
  # via
9
  # datasets
10
  # fsspec
11
+ aiosignal==1.3.2
12
  # via aiohttp
13
  annotated-types==0.7.0
14
  # via pydantic
15
+ anyio==4.7.0
16
  # via
17
  # gradio
18
  # httpx
19
  # starlette
20
+ async-timeout==5.0.1
21
  # via aiohttp
22
+ attrs==24.3.0
23
  # via aiohttp
24
+ certifi==2024.12.14
25
  # via
26
  # httpcore
27
  # httpx
28
  # requests
29
+ charset-normalizer==3.4.1
30
  # via requests
31
+ click==8.1.8
32
  # via
33
  # typer
34
  # uvicorn
35
+ datasets==3.2.0
36
  # via jmmmu-dataset-viewer (pyproject.toml)
37
  dill==0.3.8
38
  # via
 
40
  # multiprocess
41
  exceptiongroup==1.2.2
42
  # via anyio
43
+ fastapi==0.115.6
44
  # via gradio
45
+ ffmpy==0.5.0
46
  # via gradio
47
  filelock==3.16.1
48
  # via
49
  # datasets
50
  # huggingface-hub
51
+ frozenlist==1.5.0
52
  # via
53
  # aiohttp
54
  # aiosignal
55
+ fsspec==2024.9.0
56
  # via
57
  # datasets
58
  # gradio-client
59
  # huggingface-hub
60
+ gradio==5.9.1
61
  # via jmmmu-dataset-viewer (pyproject.toml)
62
+ gradio-client==1.5.2
63
  # via gradio
64
  h11==0.14.0
65
  # via
 
67
  # uvicorn
68
  hf-transfer==0.1.8
69
  # via jmmmu-dataset-viewer (pyproject.toml)
70
+ httpcore==1.0.7
71
  # via httpx
72
+ httpx==0.28.1
73
  # via
74
  # gradio
75
  # gradio-client
76
+ # safehttpx
77
+ huggingface-hub==0.27.0
78
  # via
79
  # datasets
80
  # gradio
 
85
  # httpx
86
  # requests
87
  # yarl
88
+ jinja2==3.1.5
89
  # via gradio
90
  markdown-it-py==3.0.0
91
  # via rich
 
101
  # yarl
102
  multiprocess==0.70.16
103
  # via datasets
104
+ numpy==2.2.1
105
  # via
106
  # datasets
107
  # gradio
108
  # pandas
109
+ orjson==3.10.13
 
110
  # via gradio
111
+ packaging==24.2
112
  # via
113
  # datasets
114
  # gradio
 
118
  # via
119
  # datasets
120
  # gradio
121
+ pillow==11.1.0
122
  # via gradio
123
+ propcache==0.2.1
124
+ # via
125
+ # aiohttp
126
+ # yarl
127
+ pyarrow==18.1.0
128
  # via datasets
129
+ pydantic==2.10.4
130
  # via
131
  # fastapi
132
  # gradio
133
+ pydantic-core==2.27.2
134
  # via pydantic
135
  pydub==0.25.1
136
  # via gradio
 
138
  # via rich
139
  python-dateutil==2.9.0.post0
140
  # via pandas
141
+ python-multipart==0.0.20
142
  # via gradio
143
  pytz==2024.2
144
  # via pandas
 
151
  # via
152
  # datasets
153
  # huggingface-hub
154
+ rich==13.9.4
155
  # via typer
156
+ ruff==0.8.4
157
+ # via gradio
158
+ safehttpx==0.1.6
159
  # via gradio
160
  semantic-version==2.10.0
161
  # via gradio
162
  shellingham==1.5.4
163
  # via typer
164
+ six==1.17.0
165
  # via python-dateutil
166
  sniffio==1.3.1
167
+ # via anyio
168
+ starlette==0.41.3
169
  # via
170
+ # fastapi
171
+ # gradio
172
+ tomlkit==0.13.2
 
 
173
  # via gradio
174
+ tqdm==4.67.1
175
  # via
176
  # datasets
177
  # huggingface-hub
178
+ typer==0.15.1
179
  # via gradio
180
  typing-extensions==4.12.2
181
  # via
 
192
  # uvicorn
193
  tzdata==2024.2
194
  # via pandas
195
+ urllib3==2.3.0
196
  # via requests
197
+ uvicorn==0.34.0
198
  # via gradio
199
+ websockets==14.1
200
  # via gradio-client
201
  xxhash==3.5.0
202
  # via datasets
203
+ yarl==1.18.3
204
  # via aiohttp
uv.lock CHANGED
The diff for this file is too large to render. See raw diff