Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,29 +1,12 @@
|
|
1 |
import torch
|
2 |
-
|
3 |
-
from diffusers import
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
pipe.load_lora_weights(f"{MODEL_NAME}/{LORA_FILE}")
|
12 |
-
return pipe
|
13 |
-
|
14 |
-
pipe = load_model()
|
15 |
-
|
16 |
-
def generate_image(prompt):
|
17 |
-
image = pipe(prompt).images[0]
|
18 |
-
return image
|
19 |
-
|
20 |
-
# Gradio UI
|
21 |
-
iface = gr.Interface(
|
22 |
-
fn=generate_image,
|
23 |
-
inputs=gr.Textbox(label="Enter your prompt"),
|
24 |
-
outputs=gr.Image(label="Generated Image"),
|
25 |
-
title="Wan2.1 LoRA Image Generator",
|
26 |
-
description="Generate images using the Wan2.1 LoRA model. Enter a prompt to begin."
|
27 |
-
)
|
28 |
-
|
29 |
-
iface.launch()
|
|
|
1 |
import torch
|
2 |
+
from diffusers import WanPipeline
|
3 |
+
from diffusers.utils import export_to_video
|
4 |
|
5 |
+
pipe = WanPipeline.from_pretrained(
|
6 |
+
"Wan-AI/Wan2.1-T2V-1.3B-Diffusers", torch_dtype=torch.bfloat16
|
7 |
+
).to("cuda")
|
8 |
+
pipe.load_lora_weights("finetrainers/Wan2.1-T2V-1.3B-3dgs-v0", adapter_name="wan-lora")
|
9 |
+
pipe.set_adapters(["wan-lora"], [0.5])
|
10 |
|
11 |
+
video = pipe("<my-awesome-prompt>").frames[0]
|
12 |
+
export_to_video(video, "output.mp4", fps=24)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|