zxsipola123456 commited on
Commit
42e35f7
·
verified ·
1 Parent(s): b52c42e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -20
app.py CHANGED
@@ -150,6 +150,7 @@ app = gr.Blocks()
150
  with app:
151
  gr.Markdown("# <center>TTS文本生成语音 + AI秒变声</center>")
152
  gr.Markdown("### <center>key获取地址[here](https://buy.sipola.cn),ai文案生成(可使用中转key和官方key)请访问 [here](https://ai.sipola.cn)</center>")
 
153
  with gr.Tab("中转key-TTS文本生语音"):
154
  with gr.Row(variant='panel'):
155
  api_proxy_key = gr.Textbox(type='password', label='API Key', placeholder='请在此填写您在https://buy.sipola.cn获取的中转API Key')
@@ -167,8 +168,25 @@ with app:
167
  out1 = gr.Audio(type="filepath", label="AI变声后的专属音频")
168
  btn_text.click(tts, [inp_text, model, voice, api_proxy_key], inp1)
169
  btn1.click(voice_change, [inp1, inp2], out1)
170
-
171
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  with gr.Tab("TTS-AI变声",interactive=False) as edge_tts_tab:
173
  with gr.Row():
174
  with gr.Column():
@@ -185,26 +203,9 @@ with app:
185
  btn_vc = gr.Button("一键AI变声合成", variant="primary")
186
  with gr.Column():
187
  out_vc = gr.Audio(type="filepath", label="AI变声后的专属音频")
 
188
  btn_edge.click(lambda text, lang: anyio.run(text_to_speech_edge, text, lang), [input_text, language], [output_text, output_audio])
189
  btn_vc.click(voice_change, [output_audio, inp_vc], out_vc)
190
-
191
- with gr.Tab("官方key-TTS文本生语音"):
192
- with gr.Row(variant='panel'):
193
- api_key = gr.Textbox(type='password', label='API Key', placeholder='请在此填写您在https://buy.sipola.cn 获取的官方API Key')
194
- model = gr.Dropdown(choices=['tts-1','tts-1-hd'], label='请选择模型(tts-1推理更快,tts-1-hd音质更好)', value='tts-1')
195
- voice = gr.Dropdown(choices=['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'], label='请选择一个说话人', value='alloy')
196
- with gr.Row():
197
- with gr.Column():
198
- inp_text = gr.Textbox(label="请填写您想生成的文本中英文皆可", placeholder="请输入ai生成的文案,不要超过300字,最好200字左右", lines=5)
199
- btn_text = gr.Button("一键生成音频", variant="primary")
200
- with gr.Column():
201
- inp1 = gr.Audio(type="filepath", label="TTS真实拟声", interactive=False)
202
- inp2 = gr.Audio(type="filepath", label="请上传同文案参照音频,可自己读取同文案录音")
203
- btn1 = gr.Button("一键AI变声合成", variant="primary")
204
- with gr.Column():
205
- out1 = gr.Audio(type="filepath", label="AI变声后的专属音频")
206
- btn_text.click(tts1, [inp_text, model, voice, api_key], inp1)
207
- btn1.click(voice_change, [inp1, inp2], out1)
208
  # 监听API Key输入框的变化并更新Edge TTS标签页的状态
209
  api_proxy_key.change(
210
  update_edge_tts_tab,
 
150
  with app:
151
  gr.Markdown("# <center>TTS文本生成语音 + AI秒变声</center>")
152
  gr.Markdown("### <center>key获取地址[here](https://buy.sipola.cn),ai文案生成(可使用中转key和官方key)请访问 [here](https://ai.sipola.cn)</center>")
153
+
154
  with gr.Tab("中转key-TTS文本生语音"):
155
  with gr.Row(variant='panel'):
156
  api_proxy_key = gr.Textbox(type='password', label='API Key', placeholder='请在此填写您在https://buy.sipola.cn获取的中转API Key')
 
168
  out1 = gr.Audio(type="filepath", label="AI变声后的专属音频")
169
  btn_text.click(tts, [inp_text, model, voice, api_proxy_key], inp1)
170
  btn1.click(voice_change, [inp1, inp2], out1)
171
+
172
+ with gr.Tab("官方key-TTS文本生语音"):
173
+ with gr.Row(variant='panel'):
174
+ api_key = gr.Textbox(type='password', label='API Key', placeholder='请在此填写您在https://buy.sipola.cn 获取的官方API Key')
175
+ model = gr.Dropdown(choices=['tts-1','tts-1-hd'], label='请选择模型(tts-1推理更快,tts-1-hd音质更好)', value='tts-1')
176
+ voice = gr.Dropdown(choices=['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'], label='请选择一个说话人', value='alloy')
177
+ with gr.Row():
178
+ with gr.Column():
179
+ inp_text = gr.Textbox(label="请填写您想生成的文本中英文皆可", placeholder="请输入ai生成的文案,不要超过300字,最好200字左右", lines=5)
180
+ btn_text = gr.Button("一键生成音频", variant="primary")
181
+ with gr.Column():
182
+ inp1 = gr.Audio(type="filepath", label="TTS真实拟声", interactive=False)
183
+ inp2 = gr.Audio(type="filepath", label="请上传同文案参照音频,可自己读取同文案录音")
184
+ btn1 = gr.Button("一键AI变声合成", variant="primary")
185
+ with gr.Column():
186
+ out1 = gr.Audio(type="filepath", label="AI变声后的专属音频")
187
+ btn_text.click(tts1, [inp_text, model, voice, api_key], inp1)
188
+ btn1.click(voice_change, [inp1, inp2], out1)
189
+
190
  with gr.Tab("TTS-AI变声",interactive=False) as edge_tts_tab:
191
  with gr.Row():
192
  with gr.Column():
 
203
  btn_vc = gr.Button("一键AI变声合成", variant="primary")
204
  with gr.Column():
205
  out_vc = gr.Audio(type="filepath", label="AI变声后的专属音频")
206
+
207
  btn_edge.click(lambda text, lang: anyio.run(text_to_speech_edge, text, lang), [input_text, language], [output_text, output_audio])
208
  btn_vc.click(voice_change, [output_audio, inp_vc], out_vc)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  # 监听API Key输入框的变化并更新Edge TTS标签页的状态
210
  api_proxy_key.change(
211
  update_edge_tts_tab,