Aliashraf commited on
Commit
554ba33
·
verified ·
1 Parent(s): 6696082

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from requisites.py import generate_speech, create_video
3
+
4
+ def process_text(script):
5
+ """Process text to generate an AI video."""
6
+ if not script.strip():
7
+ return "Error: No text provided!"
8
+
9
+ # Generate AI voice
10
+ audio_file = generate_speech(script)
11
+
12
+ # Generate video with AI voice
13
+ video_file = create_video(script, audio_file)
14
+
15
+ return video_file
16
+
17
+ # Gradio UI
18
+ iface = gr.Interface(
19
+ fn=process_text,
20
+ inputs=gr.Textbox(label="Enter script for AI video"),
21
+ outputs=gr.Video(label="Generated AI Video"),
22
+ title="AI Script-to-Video Generator",
23
+ description="Enter a script, and AI will generate a voiceover + video with text."
24
+ )
25
+
26
+ # Run app
27
+ if __name__ == "__main__":
28
+ iface.launch()