Ailyth commited on
Commit
88c2b88
1 Parent(s): 63f3c41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -84,7 +84,7 @@ def convert_wav_to_mp3(wav_file):
84
  os.system(" ".join(command))
85
  return output_path_mp3
86
 
87
- def tts_generator(text, sdp_ratio, noise_scale, noise_scale_w, length_scale, model):
88
  global net_g,speakers
89
  model_path = models[model]
90
  net_g, _, _, _ = utils.load_checkpoint(model_path, net_g, None, skip_optimizer=True)
@@ -115,10 +115,9 @@ if __name__ == "__main__":
115
  speaker = list(speaker_ids.keys())[0]
116
 
117
  css='''
118
- #main {background-color: background-image: linear-gradient(to top, #050e15, #13182a, #2f1a37, #501737, #6b1627)};
119
  #elements {background-color:transparent;}
120
- #btn {border: 2px solid #3ed6e500; margin-left: auto; margin-right: auto;background-color:#3ed6e500;border-radius: 5px;
121
- :hover{color: #92ccd8; } }
122
  '''
123
 
124
  with gr.Blocks(css=css) as app:
@@ -131,14 +130,12 @@ if __name__ == "__main__":
131
  info="使用huggingface的免费CPU进行推理,因此速度不快,一次性不要输入超过500汉字",
132
  elem_id="elements" )
133
  model = gr.Radio(choices=list(models.keys()), value=list(models.keys())[0], label='音声模型',elem_id="elements")
134
- #model = gr.Dropdown(choices=models,value=models[0], label='音声模型')
135
- #speaker = gr.Radio(choices=speakers, value=speakers[0], label='Speaker')
136
  gr.Markdown(value="生成参数")
137
  sdp_ratio = gr.Slider(minimum=0, maximum=1, value=0.2, step=0.01, label='语调变化',elem_id="elements")
138
  noise_scale = gr.Slider(minimum=0.1, maximum=1.5, value=0.5, step=0.01, label='感情变化')
139
  noise_scale_w = gr.Slider(minimum=0.1, maximum=1.4, value=0.9, step=0.01, label='音节长度')
140
  length_scale = gr.Slider(minimum=0.1, maximum=2, value=1, step=0.01, label='生成语音总长度')
141
- btn = gr.Button("生成", variant="primary",elem_id="btn")
142
  with gr.Column(elem_id="elements"):
143
  text_output = gr.Textbox(label="Message")
144
  audio_output = gr.Audio(label="试听")
 
84
  os.system(" ".join(command))
85
  return output_path_mp3
86
 
87
+ def tts_generator(text, sdp_ratio, noise_scale, noise_scale_w, length_scale, model):
88
  global net_g,speakers
89
  model_path = models[model]
90
  net_g, _, _, _ = utils.load_checkpoint(model_path, net_g, None, skip_optimizer=True)
 
115
  speaker = list(speaker_ids.keys())[0]
116
 
117
  css='''
118
+ #main {background-image: linear-gradient(to top, #050e15, #13182a, #2f1a37, #501737, #6b1627)};
119
  #elements {background-color:transparent;}
120
+ #btn {border: 2px solid #3ed6e500; margin-left: auto; margin-right: auto;background-color:#3ed6e500;border-radius: 5px;}
 
121
  '''
122
 
123
  with gr.Blocks(css=css) as app:
 
130
  info="使用huggingface的免费CPU进行推理,因此速度不快,一次性不要输入超过500汉字",
131
  elem_id="elements" )
132
  model = gr.Radio(choices=list(models.keys()), value=list(models.keys())[0], label='音声模型',elem_id="elements")
 
 
133
  gr.Markdown(value="生成参数")
134
  sdp_ratio = gr.Slider(minimum=0, maximum=1, value=0.2, step=0.01, label='语调变化',elem_id="elements")
135
  noise_scale = gr.Slider(minimum=0.1, maximum=1.5, value=0.5, step=0.01, label='感情变化')
136
  noise_scale_w = gr.Slider(minimum=0.1, maximum=1.4, value=0.9, step=0.01, label='音节长度')
137
  length_scale = gr.Slider(minimum=0.1, maximum=2, value=1, step=0.01, label='生成语音总长度')
138
+ btn = gr.Button("✨生成", variant="primary",elem_id="btn")
139
  with gr.Column(elem_id="elements"):
140
  text_output = gr.Textbox(label="Message")
141
  audio_output = gr.Audio(label="试听")