Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import numpy as np
|
|
5 |
import gradio as gr
|
6 |
import os
|
7 |
import gc
|
|
|
8 |
|
9 |
|
10 |
model_id = "hunyuanvideo-community/HunyuanVideo"
|
@@ -15,11 +16,15 @@ transformer = HunyuanVideoTransformer3DModel.from_pretrained(
|
|
15 |
|
16 |
pipe = HunyuanVideoPipeline.from_pretrained(model_id, transformer=transformer, torch_dtype=torch.float16)
|
17 |
pipe.vae.enable_tiling()
|
18 |
-
pipe.load_lora_weights("ovi054/ovimxVid")
|
19 |
-
pipe.to("cuda")
|
20 |
-
|
21 |
-
|
22 |
-
def generate(prompt,
|
|
|
|
|
|
|
|
|
23 |
try:
|
24 |
output = pipe(
|
25 |
prompt=prompt,
|
@@ -45,10 +50,11 @@ iface = gr.Interface(
|
|
45 |
gr.Textbox(label="Input prompt"),
|
46 |
],
|
47 |
additional_inputs = [
|
48 |
-
gr.Textbox(label="Negative prompt", value = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards"),
|
49 |
gr.Slider(label="Width", minimum=480, maximum=1280, step=16, value=832),
|
50 |
gr.Slider(label="Height", minimum=480, maximum=1280, step=16, value=832),
|
51 |
gr.Slider(minimum=1, maximum=80, step=1, label="Inference Steps", value=30)
|
|
|
52 |
],
|
53 |
outputs=gr.Image(label="output"),
|
54 |
)
|
|
|
5 |
import gradio as gr
|
6 |
import os
|
7 |
import gc
|
8 |
+
import spaces
|
9 |
|
10 |
|
11 |
model_id = "hunyuanvideo-community/HunyuanVideo"
|
|
|
16 |
|
17 |
pipe = HunyuanVideoPipeline.from_pretrained(model_id, transformer=transformer, torch_dtype=torch.float16)
|
18 |
pipe.vae.enable_tiling()
|
19 |
+
# pipe.load_lora_weights("ovi054/ovimxVid")
|
20 |
+
# pipe.to("cuda")
|
21 |
+
|
22 |
+
@spaces.GPU()
|
23 |
+
def generate(prompt, width=832, height=832, num_inference_steps=30, lora_id=None, progress=gr.Progress(track_tqdm=True)):
|
24 |
+
if lora_id and lora_id.strip() != "":
|
25 |
+
pipe.unload_lora_weights()
|
26 |
+
pipe.load_lora_weights(lora_id.strip())
|
27 |
+
pipe.to("cuda")
|
28 |
try:
|
29 |
output = pipe(
|
30 |
prompt=prompt,
|
|
|
50 |
gr.Textbox(label="Input prompt"),
|
51 |
],
|
52 |
additional_inputs = [
|
53 |
+
# gr.Textbox(label="Negative prompt", value = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards"),
|
54 |
gr.Slider(label="Width", minimum=480, maximum=1280, step=16, value=832),
|
55 |
gr.Slider(label="Height", minimum=480, maximum=1280, step=16, value=832),
|
56 |
gr.Slider(minimum=1, maximum=80, step=1, label="Inference Steps", value=30)
|
57 |
+
gr.Textbox(label="LoRA ID"),
|
58 |
],
|
59 |
outputs=gr.Image(label="output"),
|
60 |
)
|