Download Code from Smart44/Sora_x: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/spaces/Smart44/Sora_x/resolve/main/Code
- Command line
-
hf download hf://spaces/Smart44/Sora_x/Code
-
curl -L -o Code https://huggingface.co/spaces/Smart44/Sora_x/resolve/main/Code
1.13 kB
| 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() | |