fffiloni commited on
Commit
e7708ce
·
verified ·
1 Parent(s): c4f5bac

Update gradio_app.py

Browse files
Files changed (1) hide show
  1. gradio_app.py +2 -1
gradio_app.py CHANGED
@@ -126,7 +126,8 @@ def separate_speakers_video(video_path):
126
  output_files = []
127
  for i in range(ests_speech.shape[0]):
128
  separated_audio_path = os.path.join(output_dir, f"speaker_{i+1}.wav")
129
- torchaudio.save(separated_audio_path, ests_speech[i].unsqueeze(0).cpu(), TARGET_SR)
 
130
 
131
  # Attach audio back to video
132
  out_video_path = os.path.join(output_dir, f"speaker_{i+1}.mp4")
 
126
  output_files = []
127
  for i in range(ests_speech.shape[0]):
128
  separated_audio_path = os.path.join(output_dir, f"speaker_{i+1}.wav")
129
+ mono_audio = ests_speech[i].cpu().unsqueeze(0) # Shape: [1, time]
130
+ torchaudio.save(separated_audio_path, mono_audio.contiguous(), TARGET_SR, format="wav", encoding="PCM_S") # safest combo
131
 
132
  # Attach audio back to video
133
  out_video_path = os.path.join(output_dir, f"speaker_{i+1}.mp4")