Spaces:
Running
Running
kevinwang676
commited on
Commit
·
e0099fc
1
Parent(s):
44c21c7
Update app.py
Browse files
app.py
CHANGED
@@ -9,10 +9,8 @@ from modelscope.models.audio.tts import SambertHifigan
|
|
9 |
from modelscope.pipelines import pipeline
|
10 |
from modelscope.utils.constant import Tasks
|
11 |
|
12 |
-
import
|
13 |
-
|
14 |
-
from denoiser import pretrained
|
15 |
-
from denoiser.dsp import convert_audio
|
16 |
|
17 |
# model_0
|
18 |
|
@@ -115,18 +113,12 @@ def extend(audio):
|
|
115 |
|
116 |
# denoise
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
with torch.no_grad():
|
125 |
-
denoised = model1(wav[None])[0]
|
126 |
-
|
127 |
-
write("denoised.wav", model1.sample_rate, denoised.data.cpu().numpy())
|
128 |
-
|
129 |
-
return "denoised.wav"
|
130 |
|
131 |
|
132 |
app = gr.Blocks()
|
@@ -151,7 +143,7 @@ with app:
|
|
151 |
btn.click(fn=infer, inputs=[inp], outputs=[out])
|
152 |
btn1.click(fn=infer1, inputs=[inp], outputs=[out])
|
153 |
btn2.click(fn=extend, inputs=[out], outputs=[out1])
|
154 |
-
btn2.click(fn=
|
155 |
|
156 |
gr.Markdown("### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。</center>")
|
157 |
gr.HTML('''
|
|
|
9 |
from modelscope.pipelines import pipeline
|
10 |
from modelscope.utils.constant import Tasks
|
11 |
|
12 |
+
from voicefixer import VoiceFixer
|
13 |
+
voicefixer = VoiceFixer()
|
|
|
|
|
14 |
|
15 |
# model_0
|
16 |
|
|
|
113 |
|
114 |
# denoise
|
115 |
|
116 |
+
def inference(audio):
|
117 |
+
voicefixer.restore(input=audio.name, # input wav file path
|
118 |
+
output="output.wav", # output wav file path
|
119 |
+
cuda=False, # whether to use gpu acceleration
|
120 |
+
mode = int(0)) # You can try out mode 0, 1 to find out the best result
|
121 |
+
return 'output.wav'
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
|
124 |
app = gr.Blocks()
|
|
|
143 |
btn.click(fn=infer, inputs=[inp], outputs=[out])
|
144 |
btn1.click(fn=infer1, inputs=[inp], outputs=[out])
|
145 |
btn2.click(fn=extend, inputs=[out], outputs=[out1])
|
146 |
+
btn2.click(fn=inference, inputs=[out1], outputs=[out2])
|
147 |
|
148 |
gr.Markdown("### <center>注意❗:请不要生成会对个人以及组织造成侵害的内容,此程序仅供科研、学习及个人娱乐使用。</center>")
|
149 |
gr.HTML('''
|