Spaces:
Sleeping
Sleeping
Update gradio_app.py
Browse files- 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 |
-
|
|
|
|
| 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")
|