Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,16 +4,18 @@ import gradio as gr
|
|
| 4 |
import spaces
|
| 5 |
from clearvoice import ClearVoice
|
| 6 |
import os
|
|
|
|
| 7 |
|
| 8 |
@spaces.GPU
|
| 9 |
def fn_clearvoice_sr(input_wav, apply_se):
|
| 10 |
-
|
| 11 |
myClearVoice = ClearVoice(task='speech_super_resolution', model_names=['MossFormer2_SR_48K'])
|
| 12 |
fs = 48000
|
| 13 |
if apply_se:
|
|
|
|
| 14 |
myClearVoice_se = ClearVoice(task='speech_enhancement', model_names=['MossFormer2_SE_48K'])
|
| 15 |
-
output_wav_dict = myClearVoice_se(input_path=input_wav, online_write=True, output_path=
|
| 16 |
-
input_wav =
|
| 17 |
|
| 18 |
output_wav_dict = myClearVoice(input_path=input_wav, online_write=False)
|
| 19 |
if isinstance(output_wav_dict, dict):
|
|
|
|
| 4 |
import spaces
|
| 5 |
from clearvoice import ClearVoice
|
| 6 |
import os
|
| 7 |
+
import random
|
| 8 |
|
| 9 |
@spaces.GPU
|
| 10 |
def fn_clearvoice_sr(input_wav, apply_se):
|
| 11 |
+
wavname = input_wav.split('/')[-1]
|
| 12 |
myClearVoice = ClearVoice(task='speech_super_resolution', model_names=['MossFormer2_SR_48K'])
|
| 13 |
fs = 48000
|
| 14 |
if apply_se:
|
| 15 |
+
new_wavname = wavname.replace('.wav', str(random.randint(0,1000))+'.wav')
|
| 16 |
myClearVoice_se = ClearVoice(task='speech_enhancement', model_names=['MossFormer2_SE_48K'])
|
| 17 |
+
output_wav_dict = myClearVoice_se(input_path=input_wav, online_write=True, output_path=new_wavname)
|
| 18 |
+
input_wav = new_wavname
|
| 19 |
|
| 20 |
output_wav_dict = myClearVoice(input_path=input_wav, online_write=False)
|
| 21 |
if isinstance(output_wav_dict, dict):
|