Spaces:
No application file
No application file
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load model
|
5 |
+
model = pipeline("text-to-video-generation", model="damo-vilab/modelscope-text-to-video-synthesis")
|
6 |
+
|
7 |
+
def generate_video(prompt):
|
8 |
+
result = model(prompt)
|
9 |
+
output_file = "generated_video.mp4"
|
10 |
+
with open(output_file, "wb") as f:
|
11 |
+
f.write(result["video"])
|
12 |
+
return output_file
|
13 |
+
|
14 |
+
# Create Gradio interface
|
15 |
+
iface = gr.Interface(
|
16 |
+
fn=generate_video,
|
17 |
+
inputs="text",
|
18 |
+
outputs="file",
|
19 |
+
title="AI Video Creator",
|
20 |
+
description="Generate videos using AI from text input."
|
21 |
+
)
|
22 |
+
iface.launch()
|