ysharma HF staff commited on
Commit
dcabdfd
1 Parent(s): 7ebcd98

added submit event

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -31,10 +31,11 @@ with gr.Blocks() as demo:
31
  model = gr.Dropdown(choices=['tts-1','tts-1-hd'], label='Model', value='tts-1')
32
  voice = gr.Dropdown(choices=['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'], label='Voice Options', value='alloy')
33
 
34
- text = gr.Textbox(label="Input text")
35
  btn = gr.Button("Text-To-Speech")
36
  output_audio = gr.Audio(label="Speech Output")
37
 
 
38
  btn.click(fn=tts, inputs=[text, model, voice], outputs=output_audio, api_name="tts", concurrency_limit=None)
39
 
40
  demo.launch()
 
31
  model = gr.Dropdown(choices=['tts-1','tts-1-hd'], label='Model', value='tts-1')
32
  voice = gr.Dropdown(choices=['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'], label='Voice Options', value='alloy')
33
 
34
+ text = gr.Textbox(label="Input text", placeholder="Input text and press the Text-To-Speech button or press Enter.")
35
  btn = gr.Button("Text-To-Speech")
36
  output_audio = gr.Audio(label="Speech Output")
37
 
38
+ text.submit(fn=tts, inputs=[text, model, voice], outputs=output_audio, api_name="tts", concurrency_limit=None)
39
  btn.click(fn=tts, inputs=[text, model, voice], outputs=output_audio, api_name="tts", concurrency_limit=None)
40
 
41
  demo.launch()