Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -4,22 +4,19 @@ import torch
|
|
4 |
import spaces
|
5 |
import random
|
6 |
from PIL import Image
|
7 |
-
|
8 |
|
9 |
from glob import glob
|
10 |
from pathlib import Path
|
11 |
from typing import Optional
|
12 |
|
13 |
-
from diffsynth import ModelManager, SVDVideoPipeline, HunyuanDiTImagePipeline
|
14 |
-
from diffsynth import ModelManager
|
15 |
-
from diffusers.utils import load_image, export_to_video
|
16 |
|
17 |
import uuid
|
18 |
|
19 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
20 |
# Constants
|
21 |
-
|
22 |
-
MAX_SEED= 2147483647
|
23 |
CSS = """
|
24 |
footer {
|
25 |
visibility: hidden;
|
@@ -66,7 +63,7 @@ def generate(
|
|
66 |
base_count = len(glob(os.path.join(output_folder, "*.mp4")))
|
67 |
video_path = os.path.join(output_folder, f"{base_count:06d}.mp4")
|
68 |
|
69 |
-
|
70 |
input_image=image.resize((512, 512)),
|
71 |
num_frames=num_frames,
|
72 |
fps=fps_id,
|
@@ -79,7 +76,8 @@ def generate(
|
|
79 |
contrast_enhance_scale=1.2
|
80 |
)
|
81 |
model_manager.to("cpu")
|
82 |
-
|
|
|
83 |
|
84 |
return video_path, seed
|
85 |
|
|
|
4 |
import spaces
|
5 |
import random
|
6 |
from PIL import Image
|
7 |
+
import numpy as np
|
8 |
|
9 |
from glob import glob
|
10 |
from pathlib import Path
|
11 |
from typing import Optional
|
12 |
|
13 |
+
from diffsynth import save_video, ModelManager, SVDVideoPipeline, HunyuanDiTImagePipeline
|
|
|
|
|
14 |
|
15 |
import uuid
|
16 |
|
17 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
18 |
# Constants
|
19 |
+
MAX_SEED = np.iinfo(np.int32).max
|
|
|
20 |
CSS = """
|
21 |
footer {
|
22 |
visibility: hidden;
|
|
|
63 |
base_count = len(glob(os.path.join(output_folder, "*.mp4")))
|
64 |
video_path = os.path.join(output_folder, f"{base_count:06d}.mp4")
|
65 |
|
66 |
+
video = pipe(
|
67 |
input_image=image.resize((512, 512)),
|
68 |
num_frames=num_frames,
|
69 |
fps=fps_id,
|
|
|
76 |
contrast_enhance_scale=1.2
|
77 |
)
|
78 |
model_manager.to("cpu")
|
79 |
+
|
80 |
+
save_video(video, video_path, fps=fps_id)
|
81 |
|
82 |
return video_path, seed
|
83 |
|