Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,10 +3,10 @@ from moviepy.editor import AudioFileClip, ImageClip
|
|
| 3 |
|
| 4 |
def create_video(image, audio):
|
| 5 |
# Load the audio file
|
| 6 |
-
audio_clip = AudioFileClip(audio
|
| 7 |
|
| 8 |
# Load the image file and set it to the duration of the audio
|
| 9 |
-
image_clip = ImageClip(image
|
| 10 |
|
| 11 |
# Set the audio to the image clip
|
| 12 |
video_clip = image_clip.set_audio(audio_clip)
|
|
@@ -21,8 +21,8 @@ def create_video(image, audio):
|
|
| 21 |
iface = gr.Interface(
|
| 22 |
fn=create_video,
|
| 23 |
inputs=[
|
| 24 |
-
gr.Image(type="
|
| 25 |
-
gr.Audio(type="
|
| 26 |
],
|
| 27 |
outputs=gr.Video(label="Output Video"),
|
| 28 |
title="Image + Audio to Video Converter",
|
|
|
|
| 3 |
|
| 4 |
def create_video(image, audio):
|
| 5 |
# Load the audio file
|
| 6 |
+
audio_clip = AudioFileClip(audio)
|
| 7 |
|
| 8 |
# Load the image file and set it to the duration of the audio
|
| 9 |
+
image_clip = ImageClip(image).set_duration(audio_clip.duration)
|
| 10 |
|
| 11 |
# Set the audio to the image clip
|
| 12 |
video_clip = image_clip.set_audio(audio_clip)
|
|
|
|
| 21 |
iface = gr.Interface(
|
| 22 |
fn=create_video,
|
| 23 |
inputs=[
|
| 24 |
+
gr.Image(type="filepath", label="Upload Image"),
|
| 25 |
+
gr.Audio(type="filepath", label="Upload Audio")
|
| 26 |
],
|
| 27 |
outputs=gr.Video(label="Output Video"),
|
| 28 |
title="Image + Audio to Video Converter",
|