Spaces:
Running
Running
Katock
commited on
Commit
·
f2b662d
1
Parent(s):
593546f
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import os
|
|
4 |
|
5 |
import gradio as gr
|
6 |
import gradio.processing_utils as gr_processing_utils
|
|
|
7 |
import soundfile
|
8 |
|
9 |
from inference.infer_tool import Svc
|
@@ -30,6 +31,7 @@ gr.Audio.postprocess = audio_postprocess
|
|
30 |
|
31 |
def create_vc_fn(model, spk):
|
32 |
def vc_fn(input_audio, vc_transform, auto_f0, f0p):
|
|
|
33 |
if input_audio is None:
|
34 |
return "请先上传音频", None
|
35 |
sampling_rate, audio = input_audio
|
@@ -37,7 +39,7 @@ def create_vc_fn(model, spk):
|
|
37 |
if duration > 20 and limitation:
|
38 |
return "请上传小于20秒的音频,或点击右上角裁剪", None
|
39 |
|
40 |
-
|
41 |
# if len(audio.shape) > 1:
|
42 |
# audio = librosa.to_mono(audio.transpose(1, 0))
|
43 |
# if sampling_rate != 16000:
|
@@ -92,11 +94,18 @@ if __name__ == '__main__':
|
|
92 |
'</div>'
|
93 |
)
|
94 |
with gr.Column():
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
with gr.Column():
|
101 |
vc_output1 = gr.Textbox(label="输出信息")
|
102 |
vc_output2 = gr.Audio(label="输出音频")
|
|
|
4 |
|
5 |
import gradio as gr
|
6 |
import gradio.processing_utils as gr_processing_utils
|
7 |
+
import numpy as np
|
8 |
import soundfile
|
9 |
|
10 |
from inference.infer_tool import Svc
|
|
|
31 |
|
32 |
def create_vc_fn(model, spk):
|
33 |
def vc_fn(input_audio, vc_transform, auto_f0, f0p):
|
34 |
+
print("input; ", input_audio)
|
35 |
if input_audio is None:
|
36 |
return "请先上传音频", None
|
37 |
sampling_rate, audio = input_audio
|
|
|
39 |
if duration > 20 and limitation:
|
40 |
return "请上传小于20秒的音频,或点击右上角裁剪", None
|
41 |
|
42 |
+
audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
|
43 |
# if len(audio.shape) > 1:
|
44 |
# audio = librosa.to_mono(audio.transpose(1, 0))
|
45 |
# if sampling_rate != 16000:
|
|
|
94 |
'</div>'
|
95 |
)
|
96 |
with gr.Column():
|
97 |
+
with gr.Row():
|
98 |
+
vc_input = gr.Audio(label="输入干声" + ' (小于 20 秒)' if limitation else '')
|
99 |
+
with gr.Row():
|
100 |
+
with gr.Column():
|
101 |
+
vc_transform = gr.Number(label="音高调整(支持正负半音,12为一个八度)", value=0)
|
102 |
+
auto_f0 = gr.Checkbox(label="自动音高预测(正常说话可选)", value=False)
|
103 |
+
with gr.Column():
|
104 |
+
f0_predictor = gr.Radio(label="f0预测器(对电音大小有影响,可以都试试)",
|
105 |
+
choices=['crepe', 'harvest', 'dio', 'pm'], value='crepe')
|
106 |
+
with gr.Row():
|
107 |
+
vc_submit = gr.Button("生成", variant="primary")
|
108 |
+
|
109 |
with gr.Column():
|
110 |
vc_output1 = gr.Textbox(label="输出信息")
|
111 |
vc_output2 = gr.Audio(label="输出音频")
|