alexd2155 commited on
Commit
37888e8
·
verified ·
1 Parent(s): 5c8c9ca

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py (Gradio-шлюз к VEO)
2
+ import os, gradio as gr
3
+ from huggingface_hub import InferenceClient
4
+
5
+ def text2video(prompt, hf_token=None):
6
+ token = hf_token or os.getenv("HF_TOKEN")
7
+ if not token:
8
+ return None, "HF_TOKEN missing"
9
+ client = InferenceClient(provider="fal-ai", api_key=token)
10
+ try:
11
+ video = client.text_to_video(prompt, model="akhaliq/veo3.1-fast")
12
+ return (video, "video/mp4"), "OK"
13
+ except Exception as e:
14
+ return None, f"Error: {e}"
15
+
16
+ with gr.Blocks() as demo:
17
+ t = gr.Textbox(label="Prompt")
18
+ token = gr.Textbox(label="HF token (optional)", type="password")
19
+ out = gr.Video(label="Video")
20
+ msg = gr.Textbox(label="Status")
21
+ gr.Button("Generate").click(text2video, [t, token], [out, msg])
22
+
23
+ if __name__ == "__main__":
24
+ demo.launch()