Spaces:
Runtime error
Runtime error
| import torch | |
| import soundfile as sf | |
| import gradio as gr | |
| from clearvoice import ClearVoice | |
| myClearVoice = ClearVoice(task='speech_enhancement', model_names=['FRCRN_SE_16K']) | |
| def fn_clearvoice(input_wav): | |
| output_wav_dict = myClearVoice(input_path=input_wav, online_write=False) | |
| if isinstance(output_wav_dict, dict): | |
| key = next(iter(output_wav_dict)) | |
| output_wav = output_wav_dict[key] | |
| else: | |
| output_wav = output_wav_dict | |
| sf.write('enhanced.wav', output_wav, 16000) | |
| return 'enhanced.wav' | |
| se_demo = gr.Interface( | |
| fn=fn_clearvoice, | |
| inputs = [ | |
| gr.Audio(label="Input Audio", type="filepath") | |
| ], | |
| outputs = [ | |
| gr.Audio(label="Output Audio", type="filepath") | |
| ], | |
| title = "ClearVoice", | |
| description = ("Gradio demo for Speech enhancement with ClearVoice. 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/2206.07293' target='_blank'>FRCRN: Boosting Feature Representation Using Frequency Recurrence for Monaural Speech Enhancement</a> | <a href='https://github.com/speechbrain/speechbrain' target='_blank'>Github Repo</a></p>"), | |
| examples = [ | |
| ['mandarin_speech.wav'] | |
| ], | |
| cache_examples = True, | |
| ) | |
| se_demo.launch() |