File size: 1,132 Bytes
eb235c8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import gradio as gr
from gradio_client import Client
import time
# Connect to the official HunyuanVideo Space (running on A100s)
# Note: If this space gets busy, find another "HunyuanVideo" space on HF
client = Client("tencent/HunyuanVideo")
def generate_video(prompt):
try:
# This sends your prompt to their GPU
# The API parameters might change slightly depending on the specific Space
result = client.predict(
prompt=prompt,
resolution="1280x720",
num_frames=64,
num_inference_steps=50,
api_name="/generate_video" # Check the "Use via API" link at bottom of their space for exact name
)
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()
|