hysts HF staff commited on
Commit
ab1e570
1 Parent(s): dd1eded
.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.9.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.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:
@@ -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
@@ -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: gray
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 4.42.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: gray
5
  colorTo: purple
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 os
6
  import random
7
  import tempfile
@@ -30,17 +28,17 @@ if torch.cuda.is_available():
30
 
31
  def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
32
  if randomize_seed:
33
- seed = random.randint(0, MAX_SEED)
34
  return seed
35
 
36
 
37
  def to_video(frames: np.ndarray, fps: int) -> str:
38
  frames = np.clip((frames * 255), 0, 255).astype(np.uint8)
39
- out_file = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False)
40
- writer = imageio.get_writer(out_file.name, format="FFMPEG", fps=fps)
41
- for frame in frames:
42
- writer.append_data(frame)
43
- writer.close()
44
  return out_file.name
45
 
46
 
@@ -50,7 +48,7 @@ def generate(
50
  seed: int,
51
  num_frames: int,
52
  num_inference_steps: int,
53
- progress=gr.Progress(track_tqdm=True),
54
  ) -> str:
55
  generator = torch.Generator().manual_seed(seed)
56
  frames = pipe(
@@ -70,7 +68,7 @@ examples = [
70
  ["Spiderman is surfing", 0, 24, 25],
71
  ]
72
 
73
- with gr.Blocks(css="style.css") as demo:
74
  gr.Markdown(DESCRIPTION)
75
  gr.DuplicateButton(
76
  value="Duplicate Space for private use",
 
1
  #!/usr/bin/env python
2
 
 
 
3
  import os
4
  import random
5
  import tempfile
 
28
 
29
  def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
30
  if randomize_seed:
31
+ seed = random.randint(0, MAX_SEED) # noqa: S311
32
  return seed
33
 
34
 
35
  def to_video(frames: np.ndarray, fps: int) -> str:
36
  frames = np.clip((frames * 255), 0, 255).astype(np.uint8)
37
+ with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as out_file:
38
+ writer = imageio.get_writer(out_file.name, format="FFMPEG", fps=fps)
39
+ for frame in frames:
40
+ writer.append_data(frame)
41
+ writer.close()
42
  return out_file.name
43
 
44
 
 
48
  seed: int,
49
  num_frames: int,
50
  num_inference_steps: int,
51
+ progress: gr.Progress = gr.Progress(track_tqdm=True), # noqa: ARG001, B008
52
  ) -> str:
53
  generator = torch.Generator().manual_seed(seed)
54
  frames = pipe(
 
68
  ["Spiderman is surfing", 0, 24, 25],
69
  ]
70
 
71
+ with gr.Blocks(css_paths="style.css") as demo:
72
  gr.Markdown(DESCRIPTION)
73
  gr.DuplicateButton(
74
  value="Duplicate Space for private use",
pyproject.toml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "zeroscope-v2"
3
+ version = "0.1.0"
4
+ description = ""
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = [
8
+ "accelerate>=1.2.1",
9
+ "diffusers>=0.32.1",
10
+ "gradio>=5.9.1",
11
+ "hf-transfer>=0.1.8",
12
+ "imageio[ffmpeg]>=2.36.1",
13
+ "spaces>=0.31.1",
14
+ "torch==2.4.0",
15
+ "torchvision>=0.19.0",
16
+ "transformers>=4.47.1",
17
+ ]
18
+
19
+ [tool.ruff]
20
+ line-length = 119
21
+
22
+ [tool.ruff.lint]
23
+ select = ["ALL"]
24
+ ignore = [
25
+ "COM812", # missing-trailing-comma
26
+ "D203", # one-blank-line-before-class
27
+ "D213", # multi-line-summary-second-line
28
+ "E501", # line-too-long
29
+ "SIM117", # multiple-with-statements
30
+ ]
31
+ extend-ignore = [
32
+ "D100", # undocumented-public-module
33
+ "D101", # undocumented-public-class
34
+ "D102", # undocumented-public-method
35
+ "D103", # undocumented-public-function
36
+ "D104", # undocumented-public-package
37
+ "D105", # undocumented-magic-method
38
+ "D107", # undocumented-public-init
39
+ "EM101", # raw-string-in-exception
40
+ "FBT001", # boolean-type-hint-positional-argument
41
+ "FBT002", # boolean-default-value-positional-argument
42
+ "PD901", # pandas-df-variable-name
43
+ "PGH003", # blanket-type-ignore
44
+ "PLR0913", # too-many-arguments
45
+ "PLR0915", # too-many-statements
46
+ "TRY003", # raise-vanilla-args
47
+ ]
48
+ unfixable = [
49
+ "F401", # unused-import
50
+ ]
51
+
52
+ [tool.ruff.format]
53
+ docstring-code-format = true
requirements.txt CHANGED
@@ -1,10 +1,269 @@
1
- accelerate==0.33.0
2
- diffusers==0.30.1
3
- gradio==4.42.0
4
- huggingface-hub==0.24.6
5
- imageio[ffmpeg]==2.35.1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  numpy==1.26.4
7
- spaces==0.29.3
8
- torch==2.0.1
9
- torchvision==0.15.2
10
- transformers==4.44.2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file was autogenerated by uv via the following command:
2
+ # uv pip compile pyproject.toml -o requirements.txt
3
+ accelerate==1.2.1
4
+ # via zeroscope-v2 (pyproject.toml)
5
+ aiofiles==23.2.1
6
+ # via gradio
7
+ annotated-types==0.7.0
8
+ # via pydantic
9
+ anyio==4.7.0
10
+ # via
11
+ # gradio
12
+ # httpx
13
+ # starlette
14
+ certifi==2024.12.14
15
+ # via
16
+ # httpcore
17
+ # httpx
18
+ # requests
19
+ charset-normalizer==3.4.1
20
+ # via requests
21
+ click==8.1.8
22
+ # via
23
+ # typer
24
+ # uvicorn
25
+ diffusers==0.32.1
26
+ # via zeroscope-v2 (pyproject.toml)
27
+ exceptiongroup==1.2.2
28
+ # via anyio
29
+ fastapi==0.115.6
30
+ # via gradio
31
+ ffmpy==0.5.0
32
+ # via gradio
33
+ filelock==3.16.1
34
+ # via
35
+ # diffusers
36
+ # huggingface-hub
37
+ # torch
38
+ # transformers
39
+ # triton
40
+ fsspec==2024.12.0
41
+ # via
42
+ # gradio-client
43
+ # huggingface-hub
44
+ # torch
45
+ gradio==5.9.1
46
+ # via
47
+ # zeroscope-v2 (pyproject.toml)
48
+ # spaces
49
+ gradio-client==1.5.2
50
+ # via gradio
51
+ h11==0.14.0
52
+ # via
53
+ # httpcore
54
+ # uvicorn
55
+ hf-transfer==0.1.8
56
+ # via zeroscope-v2 (pyproject.toml)
57
+ httpcore==1.0.7
58
+ # via httpx
59
+ httpx==0.28.1
60
+ # via
61
+ # gradio
62
+ # gradio-client
63
+ # safehttpx
64
+ # spaces
65
+ huggingface-hub==0.27.0
66
+ # via
67
+ # accelerate
68
+ # diffusers
69
+ # gradio
70
+ # gradio-client
71
+ # tokenizers
72
+ # transformers
73
+ idna==3.10
74
+ # via
75
+ # anyio
76
+ # httpx
77
+ # requests
78
+ imageio==2.36.1
79
+ # via zeroscope-v2 (pyproject.toml)
80
+ imageio-ffmpeg==0.5.1
81
+ # via imageio
82
+ importlib-metadata==8.5.0
83
+ # via diffusers
84
+ jinja2==3.1.5
85
+ # via
86
+ # gradio
87
+ # torch
88
+ markdown-it-py==3.0.0
89
+ # via rich
90
+ markupsafe==2.1.5
91
+ # via
92
+ # gradio
93
+ # jinja2
94
+ mdurl==0.1.2
95
+ # via markdown-it-py
96
+ mpmath==1.3.0
97
+ # via sympy
98
+ networkx==3.4.2
99
+ # via torch
100
  numpy==1.26.4
101
+ # via
102
+ # accelerate
103
+ # diffusers
104
+ # gradio
105
+ # imageio
106
+ # pandas
107
+ # torchvision
108
+ # transformers
109
+ nvidia-cublas-cu12==12.1.3.1
110
+ # via
111
+ # nvidia-cudnn-cu12
112
+ # nvidia-cusolver-cu12
113
+ # torch
114
+ nvidia-cuda-cupti-cu12==12.1.105
115
+ # via torch
116
+ nvidia-cuda-nvrtc-cu12==12.1.105
117
+ # via torch
118
+ nvidia-cuda-runtime-cu12==12.1.105
119
+ # via torch
120
+ nvidia-cudnn-cu12==9.1.0.70
121
+ # via torch
122
+ nvidia-cufft-cu12==11.0.2.54
123
+ # via torch
124
+ nvidia-curand-cu12==10.3.2.106
125
+ # via torch
126
+ nvidia-cusolver-cu12==11.4.5.107
127
+ # via torch
128
+ nvidia-cusparse-cu12==12.1.0.106
129
+ # via
130
+ # nvidia-cusolver-cu12
131
+ # torch
132
+ nvidia-nccl-cu12==2.20.5
133
+ # via torch
134
+ nvidia-nvjitlink-cu12==12.6.85
135
+ # via
136
+ # nvidia-cusolver-cu12
137
+ # nvidia-cusparse-cu12
138
+ nvidia-nvtx-cu12==12.1.105
139
+ # via torch
140
+ orjson==3.10.13
141
+ # via gradio
142
+ packaging==24.2
143
+ # via
144
+ # accelerate
145
+ # gradio
146
+ # gradio-client
147
+ # huggingface-hub
148
+ # spaces
149
+ # transformers
150
+ pandas==2.2.3
151
+ # via gradio
152
+ pillow==11.0.0
153
+ # via
154
+ # diffusers
155
+ # gradio
156
+ # imageio
157
+ # torchvision
158
+ psutil==5.9.8
159
+ # via
160
+ # accelerate
161
+ # imageio
162
+ # spaces
163
+ pydantic==2.10.4
164
+ # via
165
+ # fastapi
166
+ # gradio
167
+ # spaces
168
+ pydantic-core==2.27.2
169
+ # via pydantic
170
+ pydub==0.25.1
171
+ # via gradio
172
+ pygments==2.18.0
173
+ # via rich
174
+ python-dateutil==2.9.0.post0
175
+ # via pandas
176
+ python-multipart==0.0.20
177
+ # via gradio
178
+ pytz==2024.2
179
+ # via pandas
180
+ pyyaml==6.0.2
181
+ # via
182
+ # accelerate
183
+ # gradio
184
+ # huggingface-hub
185
+ # transformers
186
+ regex==2024.11.6
187
+ # via
188
+ # diffusers
189
+ # transformers
190
+ requests==2.32.3
191
+ # via
192
+ # diffusers
193
+ # huggingface-hub
194
+ # spaces
195
+ # transformers
196
+ rich==13.9.4
197
+ # via typer
198
+ ruff==0.8.4
199
+ # via gradio
200
+ safehttpx==0.1.6
201
+ # via gradio
202
+ safetensors==0.4.5
203
+ # via
204
+ # accelerate
205
+ # diffusers
206
+ # transformers
207
+ semantic-version==2.10.0
208
+ # via gradio
209
+ setuptools==75.6.0
210
+ # via imageio-ffmpeg
211
+ shellingham==1.5.4
212
+ # via typer
213
+ six==1.17.0
214
+ # via python-dateutil
215
+ sniffio==1.3.1
216
+ # via anyio
217
+ spaces==0.31.1
218
+ # via zeroscope-v2 (pyproject.toml)
219
+ starlette==0.41.3
220
+ # via
221
+ # fastapi
222
+ # gradio
223
+ sympy==1.13.3
224
+ # via torch
225
+ tokenizers==0.21.0
226
+ # via transformers
227
+ tomlkit==0.13.2
228
+ # via gradio
229
+ torch==2.4.0
230
+ # via
231
+ # zeroscope-v2 (pyproject.toml)
232
+ # accelerate
233
+ # torchvision
234
+ torchvision==0.19.0
235
+ # via zeroscope-v2 (pyproject.toml)
236
+ tqdm==4.67.1
237
+ # via
238
+ # huggingface-hub
239
+ # transformers
240
+ transformers==4.47.1
241
+ # via zeroscope-v2 (pyproject.toml)
242
+ triton==3.0.0
243
+ # via torch
244
+ typer==0.15.1
245
+ # via gradio
246
+ typing-extensions==4.12.2
247
+ # via
248
+ # anyio
249
+ # fastapi
250
+ # gradio
251
+ # gradio-client
252
+ # huggingface-hub
253
+ # pydantic
254
+ # pydantic-core
255
+ # rich
256
+ # spaces
257
+ # torch
258
+ # typer
259
+ # uvicorn
260
+ tzdata==2024.2
261
+ # via pandas
262
+ urllib3==2.3.0
263
+ # via requests
264
+ uvicorn==0.34.0
265
+ # via gradio
266
+ websockets==14.1
267
+ # via gradio-client
268
+ zipp==3.21.0
269
+ # via importlib-metadata
uv.lock ADDED
The diff for this file is too large to render. See raw diff