PhoenixStormJr commited on
Commit
8987508
·
verified ·
1 Parent(s): 603aeea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -52,13 +52,13 @@ try:
52
  global n_spk, tgt_sr, net_g, vc, cpt, version
53
  if sid == "" or sid == []:
54
  global hubert_model
55
- if hubert_model != None: # 考虑到轮询, 需要加个判断看是否 sid 是由有模型切换到无模型的
56
  print("clean_empty_cache")
57
  del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt
58
  hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None
59
  if torch.cuda.is_available():
60
  torch.cuda.empty_cache()
61
- ###楼下不这么折腾清理不干净
62
  if_f0 = cpt.get("f0", 1)
63
  version = cpt.get("version", "v1")
64
  if version == "v1":
@@ -166,7 +166,7 @@ try:
166
  )
167
  if file_index != ""
168
  else file_index2
169
- ) # 防止小白写错,自动帮他替换掉
170
  # file_big_npy = (
171
  # file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
172
  # )
@@ -213,19 +213,19 @@ try:
213
  app = gr.Blocks()
214
  with app:
215
  with gr.Tabs():
216
- with gr.TabItem("在线demo"):
217
  gr.Markdown(
218
  value="""
219
- RVC 在线demo
220
  """
221
  )
222
- sid = gr.Dropdown(label=i18n("推理音色"), choices=sorted(names))
223
  with gr.Column():
224
  spk_item = gr.Slider(
225
  minimum=0,
226
  maximum=2333,
227
  step=1,
228
- label=i18n("请选择说话人id"),
229
  value=0,
230
  visible=False,
231
  interactive=True,
@@ -236,12 +236,12 @@ try:
236
  outputs=[spk_item],
237
  )
238
  gr.Markdown(
239
- value=i18n("男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ")
240
  )
241
- vc_input3 = gr.Audio(label="上传音频(长度小于90秒)")
242
- vc_transform0 = gr.Number(label=i18n("变调(整数, 半音数量, 升八度12降八度-12)"), value=0)
243
  f0method0 = gr.Radio(
244
- label=i18n("选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比,crepe效果好但吃GPU"),
245
  choices=["pm", "harvest", "crepe"],
246
  value="pm",
247
  interactive=True,
@@ -249,34 +249,34 @@ try:
249
  filter_radius0 = gr.Slider(
250
  minimum=0,
251
  maximum=7,
252
- label=i18n(">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音"),
253
  value=3,
254
  step=1,
255
  interactive=True,
256
  )
257
  with gr.Column():
258
  file_index1 = gr.Textbox(
259
- label=i18n("特征检索库文件路径,为空则使用下拉的选择结果"),
260
  value="",
261
  interactive=False,
262
  visible=False,
263
  )
264
  file_index2 = gr.Dropdown(
265
- label=i18n("自动检测index路径,下拉式选择(dropdown)"),
266
  choices=sorted(index_paths),
267
  interactive=True,
268
  )
269
  index_rate1 = gr.Slider(
270
  minimum=0,
271
  maximum=1,
272
- label=i18n("检索特征占比"),
273
  value=0.88,
274
  interactive=True,
275
  )
276
  resample_sr0 = gr.Slider(
277
  minimum=0,
278
  maximum=48000,
279
- label=i18n("后处理重采样至最终采样率,0为不进行重采样"),
280
  value=0,
281
  step=1,
282
  interactive=True,
@@ -284,22 +284,22 @@ try:
284
  rms_mix_rate0 = gr.Slider(
285
  minimum=0,
286
  maximum=1,
287
- label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
288
  value=1,
289
  interactive=True,
290
  )
291
  protect0 = gr.Slider(
292
  minimum=0,
293
  maximum=0.5,
294
- label=i18n("保护清辅音和呼吸声,防止电音撕裂等artifact,拉满0.5不开启,调低加大保护力度但可能降低索引效果"),
295
  value=0.33,
296
  step=0.01,
297
  interactive=True,
298
  )
299
- f0_file = gr.File(label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"))
300
- but0 = gr.Button(i18n("转换"), variant="primary")
301
- vc_output1 = gr.Textbox(label=i18n("输出信息"))
302
- vc_output2 = gr.Audio(label=i18n("输出音频(右下角三个点,点了可以下载)"))
303
  but0.click(
304
  vc_single,
305
  [
 
52
  global n_spk, tgt_sr, net_g, vc, cpt, version
53
  if sid == "" or sid == []:
54
  global hubert_model
55
+ if hubert_model != None: # Considering polling, we need to add a check to see if the sid is switched from a model to a model-free state.
56
  print("clean_empty_cache")
57
  del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt
58
  hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None
59
  if torch.cuda.is_available():
60
  torch.cuda.empty_cache()
61
+ ###The downstairs won't be clean without this much trouble
62
  if_f0 = cpt.get("f0", 1)
63
  version = cpt.get("version", "v1")
64
  if version == "v1":
 
166
  )
167
  if file_index != ""
168
  else file_index2
169
+ ) # Prevent newbies from making mistakes and automatically replace them for them
170
  # file_big_npy = (
171
  # file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
172
  # )
 
213
  app = gr.Blocks()
214
  with app:
215
  with gr.Tabs():
216
+ with gr.TabItem("Online demo"):
217
  gr.Markdown(
218
  value="""
219
+ RVC Online demo
220
  """
221
  )
222
+ sid = gr.Dropdown(label=i18n("Mystery Tone"), choices=sorted(names))
223
  with gr.Column():
224
  spk_item = gr.Slider(
225
  minimum=0,
226
  maximum=2333,
227
  step=1,
228
+ label=i18n("Please select the speaker id"),
229
  value=0,
230
  visible=False,
231
  interactive=True,
 
236
  outputs=[spk_item],
237
  )
238
  gr.Markdown(
239
+ value=i18n("For male to female, +12key is recommended, for female to male, -12key is recommended. If the sound range explodes and causes timbre distortion, you can adjust it to the appropriate range yourself.")
240
  )
241
+ vc_input3 = gr.Audio(label="Upload audio (less than 90 seconds in length)")
242
+ vc_transform0 = gr.Number(label=i18n("Transpose(integer, number of semitones, octave up 12 octave down -12)"), value=0)
243
  f0method0 = gr.Radio(
244
+ label=i18n("Select the pitch extraction algorithm. You can use pm to speed up the input singing voice. Harvest has good bass but is extremely slow. Crepe has good effect but consumes GPU."),
245
  choices=["pm", "harvest", "crepe"],
246
  value="pm",
247
  interactive=True,
 
249
  filter_radius0 = gr.Slider(
250
  minimum=0,
251
  maximum=7,
252
+ label=i18n(">=3, use median filtering on the result of harvest pitch recognition, the value is the filter radius, which can reduce mute"),
253
  value=3,
254
  step=1,
255
  interactive=True,
256
  )
257
  with gr.Column():
258
  file_index1 = gr.Textbox(
259
+ label=i18n("Feature retrieval library file path, if empty, use the drop-down selection result"),
260
  value="",
261
  interactive=False,
262
  visible=False,
263
  )
264
  file_index2 = gr.Dropdown(
265
+ label=i18n("Automatically detect index path, drop-down selection"),
266
  choices=sorted(index_paths),
267
  interactive=True,
268
  )
269
  index_rate1 = gr.Slider(
270
  minimum=0,
271
  maximum=1,
272
+ label=i18n("Search feature proportion"),
273
  value=0.88,
274
  interactive=True,
275
  )
276
  resample_sr0 = gr.Slider(
277
  minimum=0,
278
  maximum=48000,
279
+ label=i18n("Post-processing resampling to the final sampling rate, 0 means no resampling"),
280
  value=0,
281
  step=1,
282
  interactive=True,
 
284
  rms_mix_rate0 = gr.Slider(
285
  minimum=0,
286
  maximum=1,
287
+ label=i18n("The input source volume envelope replaces the output volume envelope blending ratio. The closer it is to 1, the more the output envelope is used."),
288
  value=1,
289
  interactive=True,
290
  )
291
  protect0 = gr.Slider(
292
  minimum=0,
293
  maximum=0.5,
294
+ label=i18n("Protects clear consonants and breathing sounds, and prevents electronic music tearing and other artifacts. It is not enabled when it is set to 0.5. It is more effective when it is lowered, but the indexing effect may be reduced."),
295
  value=0.33,
296
  step=0.01,
297
  interactive=True,
298
  )
299
+ f0_file = gr.File(label=i18n("F0 curve file, optional, one line per pitch, replaces the default F0 and sharp and flat tones"))
300
+ but0 = gr.Button(i18n("Convert"), variant="primary")
301
+ vc_output1 = gr.Textbox(label=i18n("Output information"))
302
+ vc_output2 = gr.Audio(label=i18n("Output audio (three dots in the lower right corner, click to download)"))
303
  but0.click(
304
  vc_single,
305
  [