RdnUser77 commited on
Commit
a1c23c9
1 Parent(s): 4735bd9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -49,6 +49,8 @@ with gr.Blocks() as demo:
49
 
50
  txt_input = gr.Textbox(label = 'Prompt text')
51
  gen_button = gr.Button('Generate')
 
 
52
 
53
  with gr.Row():
54
  output = [gr.Image(label = m) for m in default_models]
@@ -58,7 +60,8 @@ with gr.Blocks() as demo:
58
  model_choice.change(extend_choices, model_choice, current_models)
59
 
60
  for m, o in zip(current_models, output):
61
- gen_button.click(gen_fn, [m, txt_input], o)
 
62
 
63
 
64
  with gr.Tab('Single model'):
 
49
 
50
  txt_input = gr.Textbox(label = 'Prompt text')
51
  gen_button = gr.Button('Generate')
52
+ stop_button = gr.Button('Stop', variant = 'secondary', interactive = False)
53
+ gen_button.click(lambda s: gr.update(interactive = True), None, stop_button)
54
 
55
  with gr.Row():
56
  output = [gr.Image(label = m) for m in default_models]
 
60
  model_choice.change(extend_choices, model_choice, current_models)
61
 
62
  for m, o in zip(current_models, output):
63
+ gen_event = gen_button.click(gen_fn, [m, txt_input], o)
64
+ stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
65
 
66
 
67
  with gr.Tab('Single model'):