hexgrad commited on
Commit
23bc8a9
·
verified ·
1 Parent(s): c58ae3a

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -484,11 +484,13 @@ with gr.Blocks() as lf_tts:
484
  with gr.Row():
485
  segment_btn = gr.Button('Tokenize', variant='primary')
486
  generate_btn = gr.Button('Generate x0', variant='secondary', interactive=False)
 
487
  with gr.Row():
488
  segments = gr.Dataframe(headers=['#', 'Text', 'Tokens', 'Length'], row_count=(1, 'dynamic'), col_count=(4, 'fixed'), label='Segments', interactive=False, wrap=True)
489
  segments.change(fn=did_change_segments, inputs=[segments], outputs=[segment_btn, generate_btn])
490
  segment_btn.click(segment_and_tokenize, inputs=[text, voice, skip_square_brackets, newline_split], outputs=[segments])
491
- generate_btn.click(lf_generate, inputs=[segments, voice, speed, trim, pad_between, use_gpu], outputs=[audio_stream])
 
492
 
493
  with gr.Blocks() as about:
494
  gr.Markdown('''
 
484
  with gr.Row():
485
  segment_btn = gr.Button('Tokenize', variant='primary')
486
  generate_btn = gr.Button('Generate x0', variant='secondary', interactive=False)
487
+ stop_btn = gr.Button('Stop', variant='stop')
488
  with gr.Row():
489
  segments = gr.Dataframe(headers=['#', 'Text', 'Tokens', 'Length'], row_count=(1, 'dynamic'), col_count=(4, 'fixed'), label='Segments', interactive=False, wrap=True)
490
  segments.change(fn=did_change_segments, inputs=[segments], outputs=[segment_btn, generate_btn])
491
  segment_btn.click(segment_and_tokenize, inputs=[text, voice, skip_square_brackets, newline_split], outputs=[segments])
492
+ generate_event = generate_btn.click(lf_generate, inputs=[segments, voice, speed, trim, pad_between, use_gpu], outputs=[audio_stream])
493
+ stop_btn.click(fn=None, cancels=generate_event)
494
 
495
  with gr.Blocks() as about:
496
  gr.Markdown('''