Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
|
2 |
import gradio as gr
|
3 |
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
def generate_video(prompt: str):
|
6 |
-
# ← your video-gen logic goes here.
|
7 |
-
# For now, we'll simulate work & return a sample video file
|
8 |
-
time.sleep(2) # simulate processing
|
9 |
-
output_path = "example.mp4" # replace with your real file
|
10 |
-
# Return a tuple: first for the Video component, second for the File component
|
11 |
-
return output_path, output_path
|
12 |
|
13 |
with gr.Blocks() as demo:
|
14 |
# Status message at the top
|
|
|
1 |
|
2 |
import gradio as gr
|
3 |
import time
|
4 |
+
4 from moviepy.editor import TextClip, concatenate_videoclips
|
5 |
+
|
6 |
+
5 def generate_video(prompt: str):
|
7 |
+
6 # Create a 3-second clip of your prompt text
|
8 |
+
7 clip = TextClip(prompt, fontsize=70, color='white', bg_color='black', size=(640,360))
|
9 |
+
8 clip = clip.set_duration(3)
|
10 |
+
9 output_path = "out.mp4"
|
11 |
+
10 clip.write_videofile(output_path, fps=24, codec="libx264")
|
12 |
+
11 return output_path, output_path
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
with gr.Blocks() as demo:
|
16 |
# Status message at the top
|