Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,8 +3,6 @@ import soundfile as sf
|
|
| 3 |
import gradio as gr
|
| 4 |
from clearvoice import ClearVoice
|
| 5 |
|
| 6 |
-
#myClearVoice = ClearVoice(task='speech_enhancement', model_names=['FRCRN_SE_16K'])
|
| 7 |
-
|
| 8 |
def fn_clearvoice_se(input_wav):
|
| 9 |
myClearVoice = ClearVoice(task='speech_enhancement', model_names=['FRCRN_SE_16K'])
|
| 10 |
output_wav_dict = myClearVoice(input_path=input_wav, online_write=False)
|
|
@@ -21,11 +19,16 @@ def fn_clearvoice_ss(input_wav):
|
|
| 21 |
output_wav_dict = myClearVoice(input_path=input_wav, online_write=False)
|
| 22 |
if isinstance(output_wav_dict, dict):
|
| 23 |
key = next(iter(output_wav_dict))
|
| 24 |
-
|
|
|
|
|
|
|
| 25 |
else:
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
demo = gr.Blocks()
|
| 31 |
|
|
@@ -39,7 +42,8 @@ se_demo = gr.Interface(
|
|
| 39 |
],
|
| 40 |
title = "ClearVoice: Speech Enhancement",
|
| 41 |
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."),
|
| 42 |
-
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/
|
|
|
|
| 43 |
examples = [
|
| 44 |
['mandarin_speech.wav']
|
| 45 |
],
|
|
@@ -57,7 +61,8 @@ ss_demo = gr.Interface(
|
|
| 57 |
],
|
| 58 |
title = "ClearVoice: Speech Separation",
|
| 59 |
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."),
|
| 60 |
-
article = ("<p style='text-align: center'><a href='https://arxiv.org/abs/
|
|
|
|
| 61 |
examples = [
|
| 62 |
['mandarin_speech.wav']
|
| 63 |
],
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
from clearvoice import ClearVoice
|
| 5 |
|
|
|
|
|
|
|
| 6 |
def fn_clearvoice_se(input_wav):
|
| 7 |
myClearVoice = ClearVoice(task='speech_enhancement', model_names=['FRCRN_SE_16K'])
|
| 8 |
output_wav_dict = myClearVoice(input_path=input_wav, online_write=False)
|
|
|
|
| 19 |
output_wav_dict = myClearVoice(input_path=input_wav, online_write=False)
|
| 20 |
if isinstance(output_wav_dict, dict):
|
| 21 |
key = next(iter(output_wav_dict))
|
| 22 |
+
output_wav_list = output_wav_dict[key]
|
| 23 |
+
output_wav_s1 = output_wav_list[0]
|
| 24 |
+
output_wav_s2 = output_wav_list[1]
|
| 25 |
else:
|
| 26 |
+
output_wav_list = output_wav_dict
|
| 27 |
+
output_wav_s1 = output_wav_list[0]
|
| 28 |
+
output_wav_s2 = output_wav_list[1]
|
| 29 |
+
sf.write('separated_s1.wav', output_wav_s1, 16000)
|
| 30 |
+
sf.write('separated_s2.wav', output_wav_s2, 16000)
|
| 31 |
+
return "separated_s1.wav", "separated_s2.wav"
|
| 32 |
|
| 33 |
demo = gr.Blocks()
|
| 34 |
|
|
|
|
| 42 |
],
|
| 43 |
title = "ClearVoice: Speech Enhancement",
|
| 44 |
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."),
|
| 45 |
+
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/alibabasglab' target='_blank'>Github Repo</a></p>"
|
| 46 |
+
),
|
| 47 |
examples = [
|
| 48 |
['mandarin_speech.wav']
|
| 49 |
],
|
|
|
|
| 61 |
],
|
| 62 |
title = "ClearVoice: Speech Separation",
|
| 63 |
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."),
|
| 64 |
+
article = ("<p style='text-align: center'><a href='https://arxiv.org/abs/2302.11824' target='_blank'>MossFormer: Pushing the Performance Limit of Monaural Speech Separation using Gated Single-Head Transformer with Convolution-Augmented Joint Self-Attentions</a> | <a href='https://github.com/alibabasglab' target='_blank'>Github Repo</a></p>"
|
| 65 |
+
"<p style='text-align: center'><a href='https://arxiv.org/abs/2312.11825' target='_blank'>MossFormer2: Combining Transformer and RNN-Free Recurrent Network for Enhanced Time-Domain Monaural Speech Separation</a> | <a href='https://github.com/alibabasglab' target='_blank'>Github Repo</a></p>"),
|
| 66 |
examples = [
|
| 67 |
['mandarin_speech.wav']
|
| 68 |
],
|