Spaces:
Running
Running
darksakura
commited on
Commit
·
31f89b4
1
Parent(s):
5709345
Upload app.py
Browse files
app.py
CHANGED
@@ -117,15 +117,8 @@ def vc_fn(output_format,sid, input_audio, vc_transform, auto_f0,cluster_ratio, s
|
|
117 |
out_wav_path1 = 'output_'+f'{sid}_{vc_transform}.{output_format}'
|
118 |
soundfile.write(out_wav_path1, _audio, 44100, format=output_format)
|
119 |
used_time = round(time.time() - start_time, 2)
|
120 |
-
|
121 |
-
out_str = "你开启了自动f0预测,仅限转换语音,歌声不要勾选此项会究极跑调"
|
122 |
-
out_str = out_str+ ("Success! total use time:{}s".format(
|
123 |
-
used_time))
|
124 |
-
else:
|
125 |
-
out_str = (base64.b64decode( b'U3VjY2VzcyEgdG90YWwgdXNlIHRpbWU6e31z' ).decode().format(
|
126 |
-
used_time))
|
127 |
return out_str ,out_wav_path1
|
128 |
-
#return out_str ,out_wav_path1, gr.Image.update("temp.svg")
|
129 |
|
130 |
def change_audio(audio,vc):
|
131 |
new_audio = audio
|
@@ -187,10 +180,10 @@ with app:
|
|
187 |
vc_tts_submit = gr.Button("文本转语音", variant="primary")
|
188 |
spks = list(model.spk2id.keys())
|
189 |
|
190 |
-
sid = gr.Dropdown(label="音色", choices=spks, value=
|
191 |
#sid.change(fn=update_dropdown,inputs=[sid],outputs=[sid])
|
192 |
sid.update(interactive=True)
|
193 |
-
with gr.Accordion(label="↓切换模型(
|
194 |
modelstrs = gr.Dropdown(label = "模型", choices = modelPaths, value = modelPaths[0], type = "value")
|
195 |
btnMod = gr.Button("载入模型")
|
196 |
statusa = gr.TextArea()
|
@@ -201,10 +194,10 @@ with app:
|
|
201 |
f0_predictor = gr.Radio(label="f0预测器(如遇哑音可以尝试更换f0)凭干声干净程度选择。推荐fcpe和rmvpe", choices=["pm","dio","harvest","fcpe","rmvpe"], value="fcpe")
|
202 |
with gr.Row():
|
203 |
cluster_ratio = gr.Slider(label="聚类模型混合比例,0-1之间,默认为0不启用聚类,能提升音色相似度,但会导致咬字下降(如果使用建议0.5左右)",maximum=0, minimum=1, step=0.1, value=0)
|
204 |
-
output_format = gr.Radio(label=
|
205 |
vc_submit = gr.Button("音频转换", variant="primary")
|
206 |
|
207 |
-
vc_output1 = gr.Textbox(label=
|
208 |
vc_output2 = gr.Audio(label="Output Audio")
|
209 |
|
210 |
vc_submit.click(vc_fn, [output_format,sid, vc_input3, vc_transform,auto_f0,cluster_ratio, slice_db,f0_predictor], [vc_output1, vc_output2])
|
|
|
117 |
out_wav_path1 = 'output_'+f'{sid}_{vc_transform}.{output_format}'
|
118 |
soundfile.write(out_wav_path1, _audio, 44100, format=output_format)
|
119 |
used_time = round(time.time() - start_time, 2)
|
120 |
+
out_str = ("Success! total use time:{}s".format(used_time))
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
return out_str ,out_wav_path1
|
|
|
122 |
|
123 |
def change_audio(audio,vc):
|
124 |
new_audio = audio
|
|
|
180 |
vc_tts_submit = gr.Button("文本转语音", variant="primary")
|
181 |
spks = list(model.spk2id.keys())
|
182 |
|
183 |
+
sid = gr.Dropdown(label="音色", choices=spks, value="HOSHINO_MINAMI")
|
184 |
#sid.change(fn=update_dropdown,inputs=[sid],outputs=[sid])
|
185 |
sid.update(interactive=True)
|
186 |
+
with gr.Accordion(label="↓切换模型(默认58v1,音色具有抽奖性质,可切换尝试)", open=False):
|
187 |
modelstrs = gr.Dropdown(label = "模型", choices = modelPaths, value = modelPaths[0], type = "value")
|
188 |
btnMod = gr.Button("载入模型")
|
189 |
statusa = gr.TextArea()
|
|
|
194 |
f0_predictor = gr.Radio(label="f0预测器(如遇哑音可以尝试更换f0)凭干声干净程度选择。推荐fcpe和rmvpe", choices=["pm","dio","harvest","fcpe","rmvpe"], value="fcpe")
|
195 |
with gr.Row():
|
196 |
cluster_ratio = gr.Slider(label="聚类模型混合比例,0-1之间,默认为0不启用聚类,能提升音色相似度,但会导致咬字下降(如果使用建议0.5左右)",maximum=0, minimum=1, step=0.1, value=0)
|
197 |
+
output_format = gr.Radio(label="音频输出格式(MP3会导致时间轴多27ms,需合成请选flac)", choices=["flac", "mp3"], value = "flac")#格式
|
198 |
vc_submit = gr.Button("音频转换", variant="primary")
|
199 |
|
200 |
+
vc_output1 = gr.Textbox(label=b'音高平均偏差半音数量,体现转换音频的跑调情况(一般小于0.5)')
|
201 |
vc_output2 = gr.Audio(label="Output Audio")
|
202 |
|
203 |
vc_submit.click(vc_fn, [output_format,sid, vc_input3, vc_transform,auto_f0,cluster_ratio, slice_db,f0_predictor], [vc_output1, vc_output2])
|