Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,61 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from inference.wan_infer import generate_video
|
| 3 |
|
| 4 |
-
def run(prompt):
|
| 5 |
-
return generate_video(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
with gr.Blocks() as demo:
|
| 8 |
-
gr.Markdown("## Wan2.2 TI2V-5B
|
| 9 |
|
| 10 |
prompt = gr.Textbox(
|
| 11 |
label="Prompt",
|
| 12 |
-
value="A cinematic shot of a futuristic city at sunset"
|
| 13 |
)
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
output = gr.Video(label="Generated Video")
|
| 16 |
|
| 17 |
btn = gr.Button("Generate")
|
| 18 |
-
btn.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
# ✅ Gradio 6.x compatible
|
| 21 |
demo.queue(default_concurrency_limit=1)
|
| 22 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from inference.wan_infer import generate_video
|
| 3 |
|
| 4 |
+
def run(prompt, resolution, aspect, fps, seconds):
|
| 5 |
+
return generate_video(
|
| 6 |
+
prompt=prompt,
|
| 7 |
+
resolution=resolution,
|
| 8 |
+
aspect=aspect,
|
| 9 |
+
fps=fps,
|
| 10 |
+
seconds=seconds,
|
| 11 |
+
)
|
| 12 |
|
| 13 |
with gr.Blocks() as demo:
|
| 14 |
+
gr.Markdown("## Wan2.2 TI2V-5B · L40S Optimized")
|
| 15 |
|
| 16 |
prompt = gr.Textbox(
|
| 17 |
label="Prompt",
|
| 18 |
+
value="A cinematic shot of a futuristic city at sunset, dramatic lighting"
|
| 19 |
)
|
| 20 |
|
| 21 |
+
with gr.Row():
|
| 22 |
+
resolution = gr.Radio(
|
| 23 |
+
["480p", "720p"],
|
| 24 |
+
value="720p",
|
| 25 |
+
label="Resolution"
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
aspect = gr.Radio(
|
| 29 |
+
["16:9", "9:16"],
|
| 30 |
+
value="16:9",
|
| 31 |
+
label="Aspect Ratio"
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
with gr.Row():
|
| 35 |
+
fps = gr.Slider(
|
| 36 |
+
minimum=12,
|
| 37 |
+
maximum=30,
|
| 38 |
+
step=1,
|
| 39 |
+
value=24,
|
| 40 |
+
label="FPS"
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
seconds = gr.Slider(
|
| 44 |
+
minimum=2,
|
| 45 |
+
maximum=10,
|
| 46 |
+
step=1,
|
| 47 |
+
value=3,
|
| 48 |
+
label="Duration (seconds)"
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
output = gr.Video(label="Generated Video")
|
| 52 |
|
| 53 |
btn = gr.Button("Generate")
|
| 54 |
+
btn.click(
|
| 55 |
+
run,
|
| 56 |
+
inputs=[prompt, resolution, aspect, fps, seconds],
|
| 57 |
+
outputs=output
|
| 58 |
+
)
|
| 59 |
|
|
|
|
| 60 |
demo.queue(default_concurrency_limit=1)
|
| 61 |
demo.launch()
|