re-add model
Browse files
app.py
CHANGED
|
@@ -14,9 +14,11 @@ def convert_video_to_audio(video_input):
|
|
| 14 |
return audio_clip_filepath
|
| 15 |
|
| 16 |
def speechbrain(input_obj, input_obj_type):
|
| 17 |
-
|
| 18 |
if input_obj_type == "video":
|
| 19 |
aud = convert_video_to_audio(input_obj)
|
|
|
|
|
|
|
| 20 |
est_sources = model.separate_file(path=aud)
|
| 21 |
torchaudio.save("clean_audio_file.wav", est_sources[:, :, 0].detach().cpu(), 8000)
|
| 22 |
return "clean_audio_file.wav"
|
|
|
|
| 14 |
return audio_clip_filepath
|
| 15 |
|
| 16 |
def speechbrain(input_obj, input_obj_type):
|
| 17 |
+
model = separator.from_hparams(source="speechbrain/sepformer-whamr-enhancement", savedir='pretrained_models/sepformer-whamr-enhancement')
|
| 18 |
if input_obj_type == "video":
|
| 19 |
aud = convert_video_to_audio(input_obj)
|
| 20 |
+
else:
|
| 21 |
+
aud = input_obj
|
| 22 |
est_sources = model.separate_file(path=aud)
|
| 23 |
torchaudio.save("clean_audio_file.wav", est_sources[:, :, 0].detach().cpu(), 8000)
|
| 24 |
return "clean_audio_file.wav"
|