Smart44 commited on
Commit
eb235c8
·
verified ·
1 Parent(s): 14a6adb

Create Code

Browse files
Files changed (1) hide show
  1. Code +35 -0
Code ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio_client import Client
3
+ import time
4
+
5
+ # Connect to the official HunyuanVideo Space (running on A100s)
6
+ # Note: If this space gets busy, find another "HunyuanVideo" space on HF
7
+ client = Client("tencent/HunyuanVideo")
8
+
9
+ def generate_video(prompt):
10
+ try:
11
+ # This sends your prompt to their GPU
12
+ # The API parameters might change slightly depending on the specific Space
13
+ result = client.predict(
14
+ prompt=prompt,
15
+ resolution="1280x720",
16
+ num_frames=64,
17
+ num_inference_steps=50,
18
+ api_name="/generate_video" # Check the "Use via API" link at bottom of their space for exact name
19
+ )
20
+ return result
21
+ except Exception as e:
22
+ return f"Error: {str(e)}. The public space might be busy. Try again in 1 minute."
23
+
24
+ with gr.Blocks() as demo:
25
+ gr.Markdown("# 💸 Free Sora 2 Generator (Client Mode)")
26
+
27
+ with gr.Row():
28
+ prompt = gr.Textbox(label="Prompt")
29
+ btn = gr.Button("Generate")
30
+
31
+ output = gr.Video()
32
+
33
+ btn.click(generate_video, inputs=prompt, outputs=output)
34
+
35
+ demo.launch()