1littlecoder commited on
Commit
7abead3
·
verified ·
1 Parent(s): 9f6393f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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.name)
7
 
8
  # Load the image file and set it to the duration of the audio
9
- image_clip = ImageClip(image.name).set_duration(audio_clip.duration)
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="file", label="Upload Image"),
25
- gr.Audio(type="file", label="Upload Audio")
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",