fffiloni commited on
Commit
0137bbd
1 Parent(s): 721c888

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -3,8 +3,7 @@ from gradio_client import Client
3
  import os
4
  import json
5
  import re
6
- from moviepy.editor import VideoFileClip
7
- from moviepy.audio.AudioClip import AudioClip
8
  import cv2
9
 
10
  hf_token = os.environ.get("HF_TKN")
@@ -153,10 +152,13 @@ def get_tango(prompt):
153
  return result
154
 
155
  def blend_vsfx(video_in, audio_result):
156
- audioClip = AudioClip(audio_result)
157
  clip = VideoFileClip(video_in)
158
  final_clip = clip.set_audio(audioClip)
159
- final_clip.write_videofile('final_video_with_sound.mp4')
 
 
 
160
  return "final_video_with_sound.mp4"
161
 
162
  def infer(video_in, chosen_model):
 
3
  import os
4
  import json
5
  import re
6
+ from moviepy.editor import *
 
7
  import cv2
8
 
9
  hf_token = os.environ.get("HF_TKN")
 
152
  return result
153
 
154
  def blend_vsfx(video_in, audio_result):
155
+ audioClip = AudioFileClip(audio_result)
156
  clip = VideoFileClip(video_in)
157
  final_clip = clip.set_audio(audioClip)
158
+ # Set the output codec
159
+ codec = 'libx264'
160
+ audio_codec = 'aac'
161
+ final_clip.write_videofile('final_video_with_sound.mp4', codec=codec, audio_codec=audio_codec)
162
  return "final_video_with_sound.mp4"
163
 
164
  def infer(video_in, chosen_model):