File size: 1,059 Bytes
64ab341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from utils import generate_story, generate_voice, generate_images, make_video

def create_story_video(prompt, duration):
    story = generate_story(prompt, duration)
    audio_path = generate_voice(story)
    image_paths = generate_images(story)
    video_path = make_video(image_paths, audio_path)

    return story, audio_path, video_path

with gr.Blocks() as app:
    gr.Markdown("# 🎬 AI Story Video Generator")
    gr.Markdown("Generate 5–10 minute story videos with AI images + AI voice.")

    prompt = gr.Textbox(label="Story Topic", placeholder="ex: A lonely robot on Mars finds a friend...")
    duration = gr.Slider(1, 10, value=5, step=1, label="Story duration (minutes)")
    btn = gr.Button("Generate Story Video")

    story_output = gr.Textbox(label="Generated Story")
    audio_output = gr.Audio(label="AI Narration")
    video_output = gr.Video(label="Final AI Story Video")

    btn.click(create_story_video, inputs=[prompt, duration],
              outputs=[story_output, audio_output, video_output])

app.launch()