Spaces:
Runtime error
Runtime error
File size: 1,381 Bytes
2dd8e14 795c10b 2dd8e14 8d40772 2dd8e14 795c10b 2dd8e14 795c10b 2dd8e14 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from speechbrain.pretrained import SepformerSeparation as separator
import torchaudio
import gradio as gr
model = separator.from_hparams(source="speechbrain/sepformer-wsj02mix", savedir='pretrained_models\sepformer-wsj02mix')
def speechbrain(aud):
est_sources = model.separate_file(path=aud)
torchaudio.save("source1hat.wav", est_sources[:, :, 0].detach().cpu(), 8000)
torchaudio.save("source2hat.wav", est_sources[:, :, 1].detach().cpu(), 8000)
return "source1hat.wav", "source2hat.wav"
inputs = gr.components.Audio(label="Input Audio", type="filepath")
outputs = [
gr.components.Audio(label="Output Audio One", type="filepath"),
gr.components.Audio(label="Output Audio Two", type="filepath")
]
title = "Speech Seperation"
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."
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2010.13154' target='_blank'>Attention is All You Need in Speech Separation</a> | <a href='https://github.com/speechbrain/speechbrain/tree/develop/recipes/WSJ0Mix/separation' '_blank'>Github Repo</a></p>"
examples = [
['samples_audio_samples_test_mixture.wav']
]
gr.Interface(speechbrain, inputs, outputs, title=title, description=description, article=article, examples=examples).launch() |