Spaces:
No application file
No application file
Create ADAM-AI-VIDEO-LAB
Browse files- ADAM-AI-VIDEO-LAB +29 -0
ADAM-AI-VIDEO-LAB
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
API_URL = "https://api-inference.huggingface.co/models/fofr/moonvalley"
|
| 5 |
+
headers = {
|
| 6 |
+
"Authorization": f"Bearer YOUR_HUGGINGFACE_TOKEN"
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
def generate_video(prompt):
|
| 10 |
+
payload = {"inputs": prompt}
|
| 11 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 12 |
+
result = response.json()
|
| 13 |
+
|
| 14 |
+
video_url = result.get("video") or result.get("url") or (result[0].get("url") if isinstance(result, list) else None)
|
| 15 |
+
|
| 16 |
+
if not video_url:
|
| 17 |
+
return "No video returned. Try another prompt."
|
| 18 |
+
|
| 19 |
+
return video_url
|
| 20 |
+
|
| 21 |
+
iface = gr.Interface(
|
| 22 |
+
fn=generate_video,
|
| 23 |
+
inputs=gr.Textbox(lines=3, placeholder="Type your zombie/horror video prompt here..."),
|
| 24 |
+
outputs="video",
|
| 25 |
+
title="Zombie Horror Video Generator",
|
| 26 |
+
description="AI-powered app that turns your prompts into short scary videos using Moonvalley model."
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
iface.launch()
|