From 5de2d80ebd4d7dfe35d94d0db181c4b0531bf0aa Mon Sep 17 00:00:00 2001 From: Y-aang <2386139091@qq.com> Date: Wed, 19 Nov 2025 15:40:04 +0000 Subject: [PATCH] add full i2v demo --- .../gradio/serving/gradio_frontend.py | 71 ++++++++---------- examples/inference/gradio/serving/prompts.txt | 12 ++- .../gradio/serving/ray_serve_backend.py | 48 ++++++++---- images/80s_dance.jpg | Bin 0 -> 115315 bytes images/couple.jpg | Bin 0 -> 234612 bytes images/jazz.jpg | Bin 0 -> 158645 bytes images/natural.jpg | Bin 0 -> 69190 bytes images/pink.jpg | Bin 0 -> 91147 bytes images/romance.jpg | Bin 0 -> 136272 bytes images/saxophonist.jpg | Bin 0 -> 218030 bytes prompts/mixkit_i2v.jsonl | 28 +++++++ 11 files changed, 106 insertions(+), 53 deletions(-) create mode 100644 images/80s_dance.jpg create mode 100644 images/couple.jpg create mode 100644 images/jazz.jpg create mode 100644 images/natural.jpg create mode 100644 images/pink.jpg create mode 100644 images/romance.jpg create mode 100644 images/saxophonist.jpg diff --git a/examples/inference/gradio/serving/gradio_frontend.py b/examples/inference/gradio/serving/gradio_frontend.py index e4c9c2284..5108b866b 100644 --- a/examples/inference/gradio/serving/gradio_frontend.py +++ b/examples/inference/gradio/serving/gradio_frontend.py @@ -5,6 +5,7 @@ import base64 import time import json from pathlib import Path +import tempfile import gradio as gr @@ -240,9 +241,12 @@ def create_gradio_interface(backend_url: str, default_params: dict[str, Sampling return "I2V" in model_name def generate_video( - prompt, negative_prompt, use_negative_prompt, seed, guidance_scale, - num_frames, height, width, randomize_seed, model_selection, input_image, progress + prompt, negative_prompt, use_negative_prompt, guidance_scale, + num_frames, height, width, model_selection, input_image, progress ): + # Use default seed value (randomize_seed disabled) + seed = 1000 + randomize_seed = False if not client.check_health(): return None, f"Backend is not available. Please check if Ray Serve is running at {backend_url}", "" @@ -342,14 +346,12 @@ def create_gradio_interface(backend_url: str, default_params: dict[str, Sampling # 'width': params.width, # 'num_frames': params.num_frames, # 'guidance_scale': params.guidance_scale, - # 'seed': params.seed, # } return { 'height': 480, 'width': 832, 'num_frames': 73, - 'seed': 1000, } # Get available models based on what's loaded @@ -363,12 +365,12 @@ def create_gradio_interface(backend_url: str, default_params: dict[str, Sampling initial_values = get_default_values(default_model) initial_show_image = is_i2v_model(default_model) - with gr.Blocks(title="FastWan", theme=theme) as demo: + with gr.Blocks(title="CausalWan", theme=theme) as demo: gr.Image("assets/logos/logo.svg", show_label=False, container=False, height=80) gr.HTML("""
""") @@ -420,6 +422,14 @@ def create_gradio_interface(backend_url: str, default_params: dict[str, Sampling with gr.Row(equal_height=False): with gr.Column(scale=1): with gr.Tabs(): + with gr.Tab("Input Image", visible=initial_show_image) as image_tab: + gr.Markdown("**Please make sure you upload a 480x832 image**") + input_image = gr.Image( + label="", + type="filepath", + height=400, + ) + with gr.Tab("Advanced Options"): with gr.Group(): with gr.Row(): @@ -461,22 +471,8 @@ def create_gradio_interface(backend_url: str, default_params: dict[str, Sampling visible=False, ) - seed = gr.Slider( - label="Seed", - minimum=0, - maximum=1000000, - step=1, - value=initial_values['seed'], - ) - randomize_seed = gr.Checkbox(label="Randomize seed", value=False) - seed_output = gr.Number(label="Used Seed") - - with gr.Tab("Input Image", visible=initial_show_image) as image_tab: - input_image = gr.Image( - label="", - type="filepath", - height=400, - ) + # randomize_seed = gr.Checkbox(label="Randomize seed", value=False) + seed_output = gr.Number(label="Used Seed", value=1000) with gr.Column(scale=1): result = gr.Video( @@ -528,7 +524,7 @@ def create_gradio_interface(backend_url: str, default_params: dict[str, Sampling gr.HTML("""The compute for this demo is generously provided by NVIDIA. Note that this demo is meant as a preview of our distilled I2V model.
+The compute for this demo is generously provided by GMI Cloud. Note that this demo is meant as a preview of our distilled I2V model. Outside of few-step distillation, we have not yet fully optimized it for speed. Stay tuned for updates!
0RC$MABU-b^;ZSKVaHCa4d0~=f8MFA(01i^
zZlK7}6ARgCb}dUeP;;CckUYPQP(S_Dzs`%F2W|tE9ZhN^`z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