rahul7star commited on
Commit
dfa4f73
Β·
verified Β·
1 Parent(s): 1b82df5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -26
app.py CHANGED
@@ -1,29 +1,12 @@
1
  import torch
2
- import gradio as gr
3
- from diffusers import StableDiffusionPipeline
4
 
5
- # Model path from Hugging Face
6
- MODEL_NAME = "Evados/DiffSynth-Studio-Lora-Wan2.1-ComfyUI"
7
- LORA_FILE = "Wan2.1-1.3b-lora-aesthetics-v1_new.safetensors"
 
 
8
 
9
- def load_model():
10
- pipe = StableDiffusionPipeline.from_pretrained(MODEL_NAME, torch_dtype=torch.float16).to("cuda")
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)