Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,14 +12,17 @@ import gradio as gr
|
|
12 |
import spaces
|
13 |
|
14 |
model_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers"
|
15 |
-
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
|
16 |
-
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
|
17 |
flow_shift = 5.0 # 5.0 for 720P, 3.0 for 480P
|
18 |
-
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
|
19 |
|
20 |
|
21 |
@spaces.GPU()
|
22 |
def generate(prompt, negative_prompt, width=1024, height=1024, num_inference_steps=30, lora_id=None, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
|
|
|
23 |
if lora_id and lora_id.strip() != "":
|
24 |
pipe.unload_lora_weights()
|
25 |
pipe.load_lora_weights(lora_id.strip())
|
|
|
12 |
import spaces
|
13 |
|
14 |
model_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers"
|
15 |
+
# vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
|
16 |
+
# pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
|
17 |
flow_shift = 5.0 # 5.0 for 720P, 3.0 for 480P
|
18 |
+
# pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
|
19 |
|
20 |
|
21 |
@spaces.GPU()
|
22 |
def generate(prompt, negative_prompt, width=1024, height=1024, num_inference_steps=30, lora_id=None, progress=gr.Progress(track_tqdm=True)):
|
23 |
+
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
|
24 |
+
pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
|
25 |
+
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
|
26 |
if lora_id and lora_id.strip() != "":
|
27 |
pipe.unload_lora_weights()
|
28 |
pipe.load_lora_weights(lora_id.strip())
|