Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,9 @@ vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=to
|
|
15 |
pipe = WanImageToVideoPipeline.from_pretrained(
|
16 |
model_id, vae=vae, image_encoder=image_encoder, torch_dtype=torch.float16
|
17 |
)
|
18 |
-
|
|
|
|
|
19 |
|
20 |
# --- Helper Functions ---
|
21 |
def aspect_ratio_resize(image, pipe, max_area=720 * 1280):
|
@@ -50,8 +52,7 @@ def infer(first_image, last_image, prompt, guidance=5.5, frames=25):
|
|
50 |
|
51 |
# Run pipeline
|
52 |
output = pipe(
|
53 |
-
image=first_image,
|
54 |
-
last_image=last_image,
|
55 |
prompt=prompt,
|
56 |
height=height,
|
57 |
width=width,
|
@@ -80,4 +81,4 @@ demo = gr.Interface(
|
|
80 |
)
|
81 |
|
82 |
if __name__ == "__main__":
|
83 |
-
demo.launch(show_api=True)
|
|
|
15 |
pipe = WanImageToVideoPipeline.from_pretrained(
|
16 |
model_id, vae=vae, image_encoder=image_encoder, torch_dtype=torch.float16
|
17 |
)
|
18 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
+
pipe.to(device)
|
20 |
+
pipe.enable_model_cpu_offload()
|
21 |
|
22 |
# --- Helper Functions ---
|
23 |
def aspect_ratio_resize(image, pipe, max_area=720 * 1280):
|
|
|
52 |
|
53 |
# Run pipeline
|
54 |
output = pipe(
|
55 |
+
image=[first_image, last_image],
|
|
|
56 |
prompt=prompt,
|
57 |
height=height,
|
58 |
width=width,
|
|
|
81 |
)
|
82 |
|
83 |
if __name__ == "__main__":
|
84 |
+
demo.launch(show_api=True, delete_cache=(60, 60))
|