None1145 commited on
Commit
2e2f2cf
·
verified ·
1 Parent(s): 4d17e60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -70,8 +70,8 @@ def load(speaker):
70
  global sid
71
  global model
72
  sid = speaker
73
- model = Svc(models_info[speaker]["model"], models_info[speaker]["config"], cluster_model_path=models_info[speaker]["cluster"], feature_retrieval=models_info[speaker]["feature_retrieval"])
74
- return "加载成功"
75
  load(speakers[0])
76
 
77
  def vc_fn(input_audio, vc_transform, auto_f0,cluster_ratio, slice_db, noise_scale):
@@ -98,13 +98,11 @@ def vc_fn(input_audio, vc_transform, auto_f0,cluster_ratio, slice_db, noise_scal
98
  app = gr.Blocks()
99
  with app:
100
  with gr.Tabs():
101
- with gr.TabItem("模型"):
102
  speaker = gr.Dropdown(label="讲话人", choices=speakers, value=speakers[0])
103
  model_submit = gr.Button("加载模型", variant="primary")
104
  model_output1 = gr.Textbox(label="Output Message")
105
- model_submit.click(load, [speaker], [model_output1])
106
- with gr.TabItem("推理"):
107
- # sid = gr.Dropdown(label="音色", choices=speakers, value=speakers[0])
108
  vc_input3 = gr.Audio(label="上传音频")
109
  vc_transform = gr.Number(label="变调(整数,可以正负,半音数量,升高八度就是12)", value=0)
110
  cluster_ratio = gr.Number(label="聚类模型混合比例,0-1之间,默认为0不启用聚类,能提升音色相似度,但会导致咬字下降(如果使用建议0.5左右)", value=0)
@@ -114,5 +112,6 @@ with app:
114
  vc_submit = gr.Button("转换", variant="primary")
115
  vc_output1 = gr.Textbox(label="Output Message")
116
  vc_output2 = gr.Audio(label="Output Audio")
 
117
  vc_submit.click(vc_fn, [vc_input3, vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale], [vc_output1, vc_output2])
118
  app.launch()
 
70
  global sid
71
  global model
72
  sid = speaker
73
+ model = Svc(models_info[sid]["model"], models_info[sid]["config"], cluster_model_path=models_info[sid]["cluster"], feature_retrieval=models_info[sid]["feature_retrieval"])
74
+ return "加载成功", sid
75
  load(speakers[0])
76
 
77
  def vc_fn(input_audio, vc_transform, auto_f0,cluster_ratio, slice_db, noise_scale):
 
98
  app = gr.Blocks()
99
  with app:
100
  with gr.Tabs():
101
+ with gr.TabItem("推理"):
102
  speaker = gr.Dropdown(label="讲话人", choices=speakers, value=speakers[0])
103
  model_submit = gr.Button("加载模型", variant="primary")
104
  model_output1 = gr.Textbox(label="Output Message")
105
+ model_output2 = gr.Textbox(label="Output Message", value=sid)
 
 
106
  vc_input3 = gr.Audio(label="上传音频")
107
  vc_transform = gr.Number(label="变调(整数,可以正负,半音数量,升高八度就是12)", value=0)
108
  cluster_ratio = gr.Number(label="聚类模型混合比例,0-1之间,默认为0不启用聚类,能提升音色相似度,但会导致咬字下降(如果使用建议0.5左右)", value=0)
 
112
  vc_submit = gr.Button("转换", variant="primary")
113
  vc_output1 = gr.Textbox(label="Output Message")
114
  vc_output2 = gr.Audio(label="Output Audio")
115
+ model_submit.click(load, [speaker], [model_output1, model_output2])
116
  vc_submit.click(vc_fn, [vc_input3, vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale], [vc_output1, vc_output2])
117
  app.launch()