Sora_x / Code
Smart44's picture
Create Code
eb235c8 verified
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()