Commit
·
ce8a6a0
1
Parent(s):
4b68dc3
switch to voice enhancement
Browse files- app.py +3 -5
- requirements.txt +1 -1
app.py
CHANGED
@@ -2,13 +2,12 @@ from speechbrain.inference.separation import SepformerSeparation as separator
|
|
2 |
import torchaudio
|
3 |
import gradio as gr
|
4 |
|
5 |
-
model = separator.from_hparams(source="speechbrain/sepformer-
|
6 |
|
7 |
def speechbrain(aud):
|
8 |
est_sources = model.separate_file(path=aud)
|
9 |
torchaudio.save("source1hat.wav", est_sources[:, :, 0].detach().cpu(), 8000)
|
10 |
-
|
11 |
-
return "source1hat.wav", "source2hat.wav"
|
12 |
|
13 |
|
14 |
title = "Speech Seperation"
|
@@ -22,8 +21,7 @@ demo = gr.Interface(
|
|
22 |
fn=speechbrain,
|
23 |
inputs=gr.Audio(type="filepath"),
|
24 |
outputs=[
|
25 |
-
gr.Audio(label="Output Audio
|
26 |
-
gr.Audio(label="Output Audio Two", type="filepath")
|
27 |
],
|
28 |
title=title,
|
29 |
description=description,
|
|
|
2 |
import torchaudio
|
3 |
import gradio as gr
|
4 |
|
5 |
+
model = separator.from_hparams(source="speechbrain/sepformer-whamr-enhancement", savedir='pretrained_models/sepformer-whamr-enhancement')
|
6 |
|
7 |
def speechbrain(aud):
|
8 |
est_sources = model.separate_file(path=aud)
|
9 |
torchaudio.save("source1hat.wav", est_sources[:, :, 0].detach().cpu(), 8000)
|
10 |
+
return "source1hat.wav"
|
|
|
11 |
|
12 |
|
13 |
title = "Speech Seperation"
|
|
|
21 |
fn=speechbrain,
|
22 |
inputs=gr.Audio(type="filepath"),
|
23 |
outputs=[
|
24 |
+
gr.Audio(label="Output Audio", type="filepath")
|
|
|
25 |
],
|
26 |
title=title,
|
27 |
description=description,
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
speechbrain
|
2 |
torchaudio
|
3 |
-
gradio
|
|
|
1 |
speechbrain
|
2 |
torchaudio
|
3 |
+
gradio
|