Spaces:
Sleeping
Sleeping
utils.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from utils import generate_story, generate_voice, generate_images, make_video
|
| 3 |
+
|
| 4 |
+
def create_story_video(prompt, duration):
|
| 5 |
+
story = generate_story(prompt, duration)
|
| 6 |
+
audio_path = generate_voice(story)
|
| 7 |
+
image_paths = generate_images(story)
|
| 8 |
+
video_path = make_video(image_paths, audio_path)
|
| 9 |
+
|
| 10 |
+
return story, audio_path, video_path
|
| 11 |
+
|
| 12 |
+
with gr.Blocks() as app:
|
| 13 |
+
gr.Markdown("# 🎬 AI Story Video Generator")
|
| 14 |
+
gr.Markdown("Generate 5–10 minute story videos with AI images + AI voice.")
|
| 15 |
+
|
| 16 |
+
prompt = gr.Textbox(label="Story Topic", placeholder="ex: A lonely robot on Mars finds a friend...")
|
| 17 |
+
duration = gr.Slider(1, 10, value=5, step=1, label="Story duration (minutes)")
|
| 18 |
+
btn = gr.Button("Generate Story Video")
|
| 19 |
+
|
| 20 |
+
story_output = gr.Textbox(label="Generated Story")
|
| 21 |
+
audio_output = gr.Audio(label="AI Narration")
|
| 22 |
+
video_output = gr.Video(label="Final AI Story Video")
|
| 23 |
+
|
| 24 |
+
btn.click(create_story_video, inputs=[prompt, duration],
|
| 25 |
+
outputs=[story_output, audio_output, video_output])
|
| 26 |
+
|
| 27 |
+
app.launch()
|