Freeze gradio
Browse files- app.py +17 -8
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,20 +1,15 @@
|
|
1 |
-
from speechbrain.
|
2 |
import torchaudio
|
3 |
import gradio as gr
|
4 |
|
5 |
model = separator.from_hparams(source="speechbrain/sepformer-wsj02mix", savedir='pretrained_models/sepformer-wsj02mix')
|
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 |
torchaudio.save("source2hat.wav", est_sources[:, :, 1].detach().cpu(), 8000)
|
11 |
return "source1hat.wav", "source2hat.wav"
|
12 |
|
13 |
-
inputs = gr.inputs.Audio(label="Input Audio", type="filepath")
|
14 |
-
outputs = [
|
15 |
-
gr.outputs.Audio(label="Output Audio One", type="filepath"),
|
16 |
-
gr.outputs.Audio(label="Output Audio Two", type="filepath")
|
17 |
-
]
|
18 |
|
19 |
title = "Speech Seperation"
|
20 |
description = "Gradio demo for Speech Seperation by SpeechBrain. To use it, simply upload your audio, or click one of the examples to load them. Read more at the links below."
|
@@ -22,4 +17,18 @@ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2010.131
|
|
22 |
examples = [
|
23 |
['samples_audio_samples_test_mixture.wav']
|
24 |
]
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
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-wsj02mix", savedir='pretrained_models/sepformer-wsj02mix')
|
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 |
torchaudio.save("source2hat.wav", est_sources[:, :, 1].detach().cpu(), 8000)
|
11 |
return "source1hat.wav", "source2hat.wav"
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
title = "Speech Seperation"
|
15 |
description = "Gradio demo for Speech Seperation by SpeechBrain. To use it, simply upload your audio, or click one of the examples to load them. Read more at the links below."
|
|
|
17 |
examples = [
|
18 |
['samples_audio_samples_test_mixture.wav']
|
19 |
]
|
20 |
+
|
21 |
+
demo = gr.Interface(
|
22 |
+
fn=speechbrain,
|
23 |
+
inputs=gr.Audio(type="filepath"),
|
24 |
+
outputs=[
|
25 |
+
gr.Audio(label="Output Audio One", type="filepath"),
|
26 |
+
gr.Audio(label="Output Audio Two", type="filepath")
|
27 |
+
],
|
28 |
+
title=title,
|
29 |
+
description=description,
|
30 |
+
article=article,
|
31 |
+
examples=examples
|
32 |
+
)
|
33 |
+
demo.launch()
|
34 |
+
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
speechbrain
|
2 |
-
torchaudio
|
|
|
|
1 |
speechbrain
|
2 |
+
torchaudio
|
3 |
+
gradio==3.50.2
|