hysts HF Staff commited on
Commit
07b5720
·
1 Parent(s): ac3c6a0
.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,48 +13,21 @@ 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.9.0
28
  hooks:
29
  - id: mypy
30
  args: ["--ignore-missing-imports"]
31
  additional_dependencies:
32
  [
33
  "types-python-slugify",
34
- "types-requests",
35
- "types-PyYAML",
36
  "types-pytz",
 
 
37
  ]
38
- - repo: https://github.com/psf/black
39
- rev: 24.4.0
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:
49
- [
50
- "--extra-keys",
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
58
- args: ["--py37-plus"]
59
- - id: nbqa-isort
60
- args: ["--float-to-top"]
 
1
  repos:
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.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.12.12
18
  hooks:
19
+ - id: ruff-check
20
+ args: ["--fix"]
21
+ - id: ruff-format
 
 
 
 
22
  - repo: https://github.com/pre-commit/mirrors-mypy
23
+ rev: v1.17.1
24
  hooks:
25
  - id: mypy
26
  args: ["--ignore-missing-imports"]
27
  additional_dependencies:
28
  [
29
  "types-python-slugify",
 
 
30
  "types-pytz",
31
+ "types-PyYAML",
32
+ "types-requests",
33
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.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
@@ -2,29 +2,16 @@
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.formatOnSave.enabled": true
 
 
 
 
17
  }
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 😻
4
  colorFrom: indigo
5
  colorTo: green
6
  sdk: gradio
7
- sdk_version: 4.36.1
8
  app_file: app.py
9
  pinned: false
10
  ---
 
4
  colorFrom: indigo
5
  colorTo: green
6
  sdk: gradio
7
+ sdk_version: 5.44.1
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -1,7 +1,5 @@
1
  #!/usr/bin/env python
2
 
3
- from __future__ import annotations
4
-
5
  import pathlib
6
  import sys
7
 
@@ -10,13 +8,13 @@ import numpy as np
10
  import PIL.Image
11
  import spaces
12
  import torch
13
- import torchvision.transforms as T
14
  from huggingface_hub import hf_hub_download
15
 
16
  sys.path.insert(0, "CelebAMask-HQ/face_parsing")
17
 
18
- from unet import unet
19
- from utils import generate_label
20
 
21
  TITLE = "CelebAMask-HQ Face Parsing"
22
  DESCRIPTION = "This is an unofficial demo for the model provided in https://github.com/switchablenorms/CelebAMask-HQ."
@@ -68,4 +66,4 @@ demo = gr.Interface(
68
  )
69
 
70
  if __name__ == "__main__":
71
- demo.queue(max_size=20).launch()
 
1
  #!/usr/bin/env python
2
 
 
 
3
  import pathlib
4
  import sys
5
 
 
8
  import PIL.Image
9
  import spaces
10
  import torch
11
+ import torchvision.transforms as T # noqa: N812
12
  from huggingface_hub import hf_hub_download
13
 
14
  sys.path.insert(0, "CelebAMask-HQ/face_parsing")
15
 
16
+ from unet import unet # pyright: ignore[reportMissingImports]
17
+ from utils import generate_label # pyright: ignore[reportMissingImports]
18
 
19
  TITLE = "CelebAMask-HQ Face Parsing"
20
  DESCRIPTION = "This is an unofficial demo for the model provided in https://github.com/switchablenorms/CelebAMask-HQ."
 
66
  )
67
 
68
  if __name__ == "__main__":
69
+ demo.launch()
images/README.md CHANGED
@@ -4,4 +4,3 @@ These images are freely-usable ones from [Unsplash](https://unsplash.com/).
4
  - https://unsplash.com/photos/et_78QkMMQs
5
  - https://unsplash.com/photos/ILip77SbmOE
6
  - https://unsplash.com/photos/95UF6LXe-Lo
7
-
 
4
  - https://unsplash.com/photos/et_78QkMMQs
5
  - https://unsplash.com/photos/ILip77SbmOE
6
  - https://unsplash.com/photos/95UF6LXe-Lo
 
pyproject.toml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "celebamask-hq-face-parsing"
3
+ version = "0.1.0"
4
+ description = ""
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = [
8
+ "gradio>=5.44.1",
9
+ "hf-transfer>=0.1.9",
10
+ "opencv-python-headless>=4.12.0.88",
11
+ "spaces>=0.40.1",
12
+ "torch==2.8.0",
13
+ "torchvision>=0.23.0",
14
+ ]
15
+
16
+ [tool.ruff]
17
+ line-length = 119
18
+
19
+ [tool.ruff.lint]
20
+ select = ["ALL"]
21
+ ignore = [
22
+ "COM812", # missing-trailing-comma
23
+ "D203", # one-blank-line-before-class
24
+ "D213", # multi-line-summary-second-line
25
+ "E501", # line-too-long
26
+ "SIM117", # multiple-with-statements
27
+ #
28
+ "D100", # undocumented-public-module
29
+ "D101", # undocumented-public-class
30
+ "D102", # undocumented-public-method
31
+ "D103", # undocumented-public-function
32
+ "D104", # undocumented-public-package
33
+ "D105", # undocumented-magic-method
34
+ "D107", # undocumented-public-init
35
+ "EM101", # raw-string-in-exception
36
+ "FBT001", # boolean-type-hint-positional-argument
37
+ "FBT002", # boolean-default-value-positional-argument
38
+ "PD901", # pandas-df-variable-name
39
+ "PGH003", # blanket-type-ignore
40
+ "PLR0913", # too-many-arguments
41
+ "PLR0915", # too-many-statements
42
+ "TRY003", # raise-vanilla-args
43
+ ]
44
+ unfixable = [
45
+ "F401", # unused-import
46
+ ]
47
+
48
+ [tool.ruff.lint.pydocstyle]
49
+ convention = "google"
50
+
51
+ [tool.ruff.lint.per-file-ignores]
52
+ "*.ipynb" = ["T201", "T203"]
53
+
54
+ [tool.ruff.format]
55
+ docstring-code-format = true
requirements.txt CHANGED
@@ -1,7 +1,238 @@
1
- gradio==4.36.1
2
- numpy==1.26.4
3
- opencv-python-headless==4.9.0.80
4
- Pillow==10.3.0
5
- spaces==0.28.3
6
- torch==2.0.1
7
- torchvision==0.15.2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file was autogenerated by uv via the following command:
2
+ # uv pip compile pyproject.toml -o requirements.txt
3
+ aiofiles==24.1.0
4
+ # via gradio
5
+ annotated-types==0.7.0
6
+ # via pydantic
7
+ anyio==4.10.0
8
+ # via
9
+ # gradio
10
+ # httpx
11
+ # starlette
12
+ brotli==1.1.0
13
+ # via gradio
14
+ certifi==2025.8.3
15
+ # via
16
+ # httpcore
17
+ # httpx
18
+ # requests
19
+ charset-normalizer==3.4.3
20
+ # via requests
21
+ click==8.2.1
22
+ # via
23
+ # typer
24
+ # uvicorn
25
+ exceptiongroup==1.3.0
26
+ # via anyio
27
+ fastapi==0.116.1
28
+ # via gradio
29
+ ffmpy==0.6.1
30
+ # via gradio
31
+ filelock==3.19.1
32
+ # via
33
+ # huggingface-hub
34
+ # torch
35
+ fsspec==2025.9.0
36
+ # via
37
+ # gradio-client
38
+ # huggingface-hub
39
+ # torch
40
+ gradio==5.44.1
41
+ # via
42
+ # celebamask-hq-face-parsing (pyproject.toml)
43
+ # spaces
44
+ gradio-client==1.12.1
45
+ # via gradio
46
+ groovy==0.1.2
47
+ # via gradio
48
+ h11==0.16.0
49
+ # via
50
+ # httpcore
51
+ # uvicorn
52
+ hf-transfer==0.1.9
53
+ # via celebamask-hq-face-parsing (pyproject.toml)
54
+ hf-xet==1.1.9
55
+ # via huggingface-hub
56
+ httpcore==1.0.9
57
+ # via httpx
58
+ httpx==0.28.1
59
+ # via
60
+ # gradio
61
+ # gradio-client
62
+ # safehttpx
63
+ # spaces
64
+ huggingface-hub==0.34.4
65
+ # via
66
+ # gradio
67
+ # gradio-client
68
+ idna==3.10
69
+ # via
70
+ # anyio
71
+ # httpx
72
+ # requests
73
+ jinja2==3.1.6
74
+ # via
75
+ # gradio
76
+ # torch
77
+ markdown-it-py==4.0.0
78
+ # via rich
79
+ markupsafe==3.0.2
80
+ # via
81
+ # gradio
82
+ # jinja2
83
+ mdurl==0.1.2
84
+ # via markdown-it-py
85
+ mpmath==1.3.0
86
+ # via sympy
87
+ networkx==3.4.2
88
+ # via torch
89
+ numpy==2.2.6
90
+ # via
91
+ # gradio
92
+ # opencv-python-headless
93
+ # pandas
94
+ # torchvision
95
+ nvidia-cublas-cu12==12.8.4.1
96
+ # via
97
+ # nvidia-cudnn-cu12
98
+ # nvidia-cusolver-cu12
99
+ # torch
100
+ nvidia-cuda-cupti-cu12==12.8.90
101
+ # via torch
102
+ nvidia-cuda-nvrtc-cu12==12.8.93
103
+ # via torch
104
+ nvidia-cuda-runtime-cu12==12.8.90
105
+ # via torch
106
+ nvidia-cudnn-cu12==9.10.2.21
107
+ # via torch
108
+ nvidia-cufft-cu12==11.3.3.83
109
+ # via torch
110
+ nvidia-cufile-cu12==1.13.1.3
111
+ # via torch
112
+ nvidia-curand-cu12==10.3.9.90
113
+ # via torch
114
+ nvidia-cusolver-cu12==11.7.3.90
115
+ # via torch
116
+ nvidia-cusparse-cu12==12.5.8.93
117
+ # via
118
+ # nvidia-cusolver-cu12
119
+ # torch
120
+ nvidia-cusparselt-cu12==0.7.1
121
+ # via torch
122
+ nvidia-nccl-cu12==2.27.3
123
+ # via torch
124
+ nvidia-nvjitlink-cu12==12.8.93
125
+ # via
126
+ # nvidia-cufft-cu12
127
+ # nvidia-cusolver-cu12
128
+ # nvidia-cusparse-cu12
129
+ # torch
130
+ nvidia-nvtx-cu12==12.8.90
131
+ # via torch
132
+ opencv-python-headless==4.12.0.88
133
+ # via celebamask-hq-face-parsing (pyproject.toml)
134
+ orjson==3.11.3
135
+ # via gradio
136
+ packaging==25.0
137
+ # via
138
+ # gradio
139
+ # gradio-client
140
+ # huggingface-hub
141
+ # spaces
142
+ pandas==2.3.2
143
+ # via gradio
144
+ pillow==10.3.0
145
+ # via
146
+ # gradio
147
+ # torchvision
148
+ psutil==5.9.8
149
+ # via spaces
150
+ pydantic==2.11.7
151
+ # via
152
+ # fastapi
153
+ # gradio
154
+ # spaces
155
+ pydantic-core==2.33.2
156
+ # via pydantic
157
+ pydub==0.25.1
158
+ # via gradio
159
+ pygments==2.19.2
160
+ # via rich
161
+ python-dateutil==2.9.0.post0
162
+ # via pandas
163
+ python-multipart==0.0.20
164
+ # via gradio
165
+ pytz==2025.2
166
+ # via pandas
167
+ pyyaml==6.0.2
168
+ # via
169
+ # gradio
170
+ # huggingface-hub
171
+ requests==2.32.5
172
+ # via
173
+ # huggingface-hub
174
+ # spaces
175
+ rich==14.1.0
176
+ # via typer
177
+ ruff==0.12.12
178
+ # via gradio
179
+ safehttpx==0.1.6
180
+ # via gradio
181
+ semantic-version==2.10.0
182
+ # via gradio
183
+ setuptools==80.9.0
184
+ # via triton
185
+ shellingham==1.5.4
186
+ # via typer
187
+ six==1.17.0
188
+ # via python-dateutil
189
+ sniffio==1.3.1
190
+ # via anyio
191
+ spaces==0.40.1
192
+ # via celebamask-hq-face-parsing (pyproject.toml)
193
+ starlette==0.47.3
194
+ # via
195
+ # fastapi
196
+ # gradio
197
+ sympy==1.14.0
198
+ # via torch
199
+ tomlkit==0.13.3
200
+ # via gradio
201
+ torch==2.8.0
202
+ # via
203
+ # celebamask-hq-face-parsing (pyproject.toml)
204
+ # torchvision
205
+ torchvision==0.23.0
206
+ # via celebamask-hq-face-parsing (pyproject.toml)
207
+ tqdm==4.67.1
208
+ # via huggingface-hub
209
+ triton==3.4.0
210
+ # via torch
211
+ typer==0.17.3
212
+ # via gradio
213
+ typing-extensions==4.15.0
214
+ # via
215
+ # anyio
216
+ # exceptiongroup
217
+ # fastapi
218
+ # gradio
219
+ # gradio-client
220
+ # huggingface-hub
221
+ # pydantic
222
+ # pydantic-core
223
+ # spaces
224
+ # starlette
225
+ # torch
226
+ # typer
227
+ # typing-inspection
228
+ # uvicorn
229
+ typing-inspection==0.4.1
230
+ # via pydantic
231
+ tzdata==2025.2
232
+ # via pandas
233
+ urllib3==2.5.0
234
+ # via requests
235
+ uvicorn==0.35.0
236
+ # via gradio
237
+ websockets==15.0.1
238
+ # via gradio-client
uv.lock ADDED
The diff for this file is too large to render. See raw diff