Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,12 +22,11 @@ MODEL_DIR = os.path.abspath("ckpts")
|
|
| 22 |
HF_MAIN_REPO = "tencent/HunyuanVideo-1.5"
|
| 23 |
HF_GLYPH_REPO = "multimodalart/glyph-sdxl-v2-byt5-small"
|
| 24 |
HF_LLM_REPO = "Qwen/Qwen2.5-VL-7B-Instruct"
|
| 25 |
-
HF_VISION_REPO = "black-forest-labs/FLUX.1-Redux-dev"
|
| 26 |
|
| 27 |
# Configuration
|
| 28 |
TRANSFORMER_VERSION = "480p_i2v_distilled"
|
| 29 |
DTYPE = torch.bfloat16
|
| 30 |
-
# ZeroGPU: Set False so we control offloading manually (CPU -> GPU -> CPU)
|
| 31 |
ENABLE_OFFLOADING = False
|
| 32 |
|
| 33 |
def setup_environment():
|
|
@@ -303,25 +302,28 @@ def generate(input_image, prompt, length, steps, shift, seed, guidance, do_rewri
|
|
| 303 |
return output_path, actual_prompt
|
| 304 |
|
| 305 |
# --- Part 6: UI ---
|
| 306 |
-
|
|
|
|
| 307 |
def create_ui():
|
| 308 |
-
with gr.Blocks(title="HunyuanVideo 1.5 I2V") as demo:
|
| 309 |
-
gr.Markdown(f"
|
|
|
|
| 310 |
|
| 311 |
with gr.Row():
|
| 312 |
with gr.Column():
|
| 313 |
-
img = gr.Image(label="Reference", type="pil"
|
| 314 |
prompt = gr.Textbox(label="Prompt", placeholder="Describe motion...", lines=2)
|
| 315 |
-
rewrite_chk = gr.Checkbox(label="Enable Prompt Rewrite (Recommended)", value=True)
|
| 316 |
|
| 317 |
-
with gr.
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
|
|
|
| 325 |
|
| 326 |
with gr.Column():
|
| 327 |
out = gr.Video(label="Result", autoplay=True)
|
|
|
|
| 22 |
HF_MAIN_REPO = "tencent/HunyuanVideo-1.5"
|
| 23 |
HF_GLYPH_REPO = "multimodalart/glyph-sdxl-v2-byt5-small"
|
| 24 |
HF_LLM_REPO = "Qwen/Qwen2.5-VL-7B-Instruct"
|
| 25 |
+
HF_VISION_REPO = "black-forest-labs/FLUX.1-Redux-dev"
|
| 26 |
|
| 27 |
# Configuration
|
| 28 |
TRANSFORMER_VERSION = "480p_i2v_distilled"
|
| 29 |
DTYPE = torch.bfloat16
|
|
|
|
| 30 |
ENABLE_OFFLOADING = False
|
| 31 |
|
| 32 |
def setup_environment():
|
|
|
|
| 302 |
return output_path, actual_prompt
|
| 303 |
|
| 304 |
# --- Part 6: UI ---
|
| 305 |
+
css = '''#col-container { max-width: 900px; margin: 0 auto; }
|
| 306 |
+
.dark .progress-text{color: white !important}'''
|
| 307 |
def create_ui():
|
| 308 |
+
with gr.Blocks(title="HunyuanVideo 1.5 I2V", css=css) as demo:
|
| 309 |
+
gr.Markdown(f"#🎬 HunyuanVideo 1.5 I2V 480p distilled demo")
|
| 310 |
+
gr.Markdown(f"This is a demo for HunyuanVideo 1.5 I2v {TRANSFORMER_VERSION}, released together with a collection of 10 other checkpoints (text-to-video, 720p, upscalers). Check out the [HunyuanVideo-1.5 model page](https://huggingface.co/tencent/HunyuanVideo-1.5) for more")
|
| 311 |
|
| 312 |
with gr.Row():
|
| 313 |
with gr.Column():
|
| 314 |
+
img = gr.Image(label="Reference", type="pil")
|
| 315 |
prompt = gr.Textbox(label="Prompt", placeholder="Describe motion...", lines=2)
|
| 316 |
+
rewrite_chk = gr.Checkbox(label="Enable Prompt Rewrite (Strongly Recommended)", value=True)
|
| 317 |
|
| 318 |
+
with gr.Accordion("Advanced Options", open=False):
|
| 319 |
+
with gr.Row():
|
| 320 |
+
steps = gr.Slider(2, 50, value=6, step=1, label="Steps")
|
| 321 |
+
guidance = gr.Slider(1.0, 5.0, value=1.0, step=0.1, label="Guidance")
|
| 322 |
+
with gr.Row():
|
| 323 |
+
shift = gr.Slider(1.0, 20.0, value=5.0, step=0.5, label="Shift")
|
| 324 |
+
length = gr.Slider(1, 129, value=61, step=4, label="Length")
|
| 325 |
+
seed = gr.Number(value=-1, label="Seed", precision=0, info="-1 is a random seed")
|
| 326 |
+
btn = gr.Button("Generate", variant="primary")
|
| 327 |
|
| 328 |
with gr.Column():
|
| 329 |
out = gr.Video(label="Result", autoplay=True)
|