Plachta commited on
Commit
f5b3018
1 Parent(s): cabdd6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -282,10 +282,17 @@ if __name__ == "__main__":
282
  text_output = gr.Textbox(label="Output Text")
283
  audio_output = gr.Audio(label="Output Audio", elem_id="tts-audio")
284
  btn = gr.Button("Generate!")
 
 
 
 
 
285
  with gr.Accordion(label="Speaking Pace Control", open=True):
286
  phoneme_output = gr.Textbox(label="Output Phonemes", interactive=False)
287
- duration_output = gr.Textbox(label="Duration of each phoneme", placeholder="After you generate a sentence, the detailed information of each phoneme's duration will be presented here. You can edit phoneme durations here and click regenerate for more precise control.",
288
  interactive = True)
 
 
289
  gr.Markdown(
290
  "\{ \}内的数字代表每个音素在生成的音频中的长度,\{ \}外的数字代表音素之间间隔的长度。"
291
  "您可以手动修改这些数字来控制每个音素以及间隔的长度,从而完全控制合成音频的说话节奏。"
@@ -294,13 +301,7 @@ if __name__ == "__main__":
294
  "You can manually change the numbers to adjust the length of each phoneme, so that speaking pace can be completely controlled."
295
  "Note that these numbers should be integers only. \n\n(1 represents a length of 0.01161 seconds)\n\n"
296
  )
297
- cus_dur_gn_btn = gr.Button("Regenerate with custom phoneme durations")
298
- btn.click(infer, inputs=[textbox, char_dropdown, language_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider, symbol_input],
299
- outputs=[text_output, audio_output, phoneme_output, duration_output])
300
- cus_dur_gn_btn.click(infer_from_phoneme_dur, inputs=[duration_output, char_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider],
301
- outputs=[phoneme_output, audio_output])
302
- download = gr.Button("Download Audio")
303
- download.click(None, [], [], _js=download_audio_js.format(audio_id="tts-audio"))
304
  examples = [['haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......', '29:米浴', '日本語', 1, 0.667, 0.8, True],
305
  ['お疲れ様です,トレーナーさん。', '1:无声铃鹿', '日本語', 1, 0.667, 0.8, False],
306
  ['張り切っていこう!', '67:北部玄驹', '日本語', 1, 0.667, 0.8, False],
 
282
  text_output = gr.Textbox(label="Output Text")
283
  audio_output = gr.Audio(label="Output Audio", elem_id="tts-audio")
284
  btn = gr.Button("Generate!")
285
+ cus_dur_gn_btn = gr.Button("Regenerate with custom phoneme durations")
286
+ btn.click(infer, inputs=[textbox, char_dropdown, language_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider, symbol_input],
287
+ outputs=[text_output, audio_output, phoneme_output, duration_output])
288
+ download = gr.Button("Download Audio")
289
+ download.click(None, [], [], _js=download_audio_js.format(audio_id="tts-audio"))
290
  with gr.Accordion(label="Speaking Pace Control", open=True):
291
  phoneme_output = gr.Textbox(label="Output Phonemes", interactive=False)
292
+ duration_output = gr.Textbox(label="Duration of each phoneme", placeholder="After you generate a sentence, the detailed information of each phoneme's duration will be presented here.",
293
  interactive = True)
294
+ cus_dur_gn_btn.click(infer_from_phoneme_dur, inputs=[duration_output, char_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider],
295
+ outputs=[phoneme_output, audio_output])
296
  gr.Markdown(
297
  "\{ \}内的数字代表每个音素在生成的音频中的长度,\{ \}外的数字代表音素之间间隔的长度。"
298
  "您可以手动修改这些数字来控制每个音素以及间隔的长度,从而完全控制合成音频的说话节奏。"
 
301
  "You can manually change the numbers to adjust the length of each phoneme, so that speaking pace can be completely controlled."
302
  "Note that these numbers should be integers only. \n\n(1 represents a length of 0.01161 seconds)\n\n"
303
  )
304
+
 
 
 
 
 
 
305
  examples = [['haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......', '29:米浴', '日本語', 1, 0.667, 0.8, True],
306
  ['お疲れ様です,トレーナーさん。', '1:无声铃鹿', '日本語', 1, 0.667, 0.8, False],
307
  ['張り切っていこう!', '67:北部玄驹', '日本語', 1, 0.667, 0.8, False],