| import gradio as gr |
| from gradio_client import Client |
| import time |
|
|
| |
| |
| client = Client("tencent/HunyuanVideo") |
|
|
| def generate_video(prompt): |
| try: |
| |
| |
| result = client.predict( |
| prompt=prompt, |
| resolution="1280x720", |
| num_frames=64, |
| num_inference_steps=50, |
| api_name="/generate_video" |
| ) |
| return result |
| except Exception as e: |
| return f"Error: {str(e)}. The public space might be busy. Try again in 1 minute." |
|
|
| with gr.Blocks() as demo: |
| gr.Markdown("# 💸 Free Sora 2 Generator (Client Mode)") |
| |
| with gr.Row(): |
| prompt = gr.Textbox(label="Prompt") |
| btn = gr.Button("Generate") |
| |
| output = gr.Video() |
| |
| btn.click(generate_video, inputs=prompt, outputs=output) |
|
|
| demo.launch() |
|
|