fffiloni commited on
Commit
316d37b
·
verified ·
1 Parent(s): a33552a

fix a bug with audio on video speaker separation

Browse files
Files changed (1) hide show
  1. gradio_app.py +4 -5
gradio_app.py CHANGED
@@ -121,13 +121,12 @@ def separate_speakers_video(video_path):
121
  output_dir = os.path.join("output_sep_video", session_id)
122
  os.makedirs(output_dir, exist_ok=True)
123
 
124
- output_videos = []
125
  for i in range(ests_speech.shape[0]):
126
  path = os.path.join(output_dir, f"speaker_{i+1}.wav")
127
- sf.write(path, ests_speech[i].cpu().numpy(), TARGET_SR)
128
- video_path = os.path.join(output_dir, f"speaker_{i+1}_video.mp4")
129
- attach_audio_to_video(video, path, video_path)
130
- output_videos.append(video_path)
131
 
132
  updates = []
133
  for i in range(MAX_SPEAKERS):
 
121
  output_dir = os.path.join("output_sep_video", session_id)
122
  os.makedirs(output_dir, exist_ok=True)
123
 
124
+ output_files = []
125
  for i in range(ests_speech.shape[0]):
126
  path = os.path.join(output_dir, f"speaker_{i+1}.wav")
127
+ audio_np = ests_speech[i].cpu().numpy().astype("float32")
128
+ sf.write(path, audio_np, TARGET_SR, format='WAV')
129
+ output_files.append(path)
 
130
 
131
  updates = []
132
  for i in range(MAX_SPEAKERS):