Spaces:
Running
Running
| # app.py (Gradio-шлюз к VEO) | |
| import os, gradio as gr | |
| from huggingface_hub import InferenceClient | |
| def text2video(prompt, hf_token=None): | |
| token = hf_token or os.getenv("HF_TOKEN") | |
| if not token: | |
| return None, "HF_TOKEN missing" | |
| client = InferenceClient(provider="fal-ai", api_key=token) | |
| try: | |
| video = client.text_to_video(prompt, model="akhaliq/veo3.1-fast") | |
| return (video, "video/mp4"), "OK" | |
| except Exception as e: | |
| return None, f"Error: {e}" | |
| with gr.Blocks() as demo: | |
| t = gr.Textbox(label="Prompt") | |
| token = gr.Textbox(label="HF token (optional)", type="password") | |
| out = gr.Video(label="Video") | |
| msg = gr.Textbox(label="Status") | |
| gr.Button("Generate").click(text2video, [t, token], [out, msg]) | |
| if __name__ == "__main__": | |
| demo.launch() |