John6666 commited on
Commit
87794e4
β€’
1 Parent(s): d465d01

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -134,8 +134,8 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', fill_width=True, css=CSS) as demo:
134
  with gr.Row():
135
  gen_button = gr.Button(f'Generate up to {int(num_models)} images in up to 3 minutes total', variant='primary', scale=3)
136
  random_button = gr.Button(f'Random {int(num_models)} 🎲', variant='secondary', scale=1)
137
- stop_button = gr.Button('Stop', variant='stop', interactive=False, scale=1)
138
- gen_button.click(lambda: gr.update(interactive=True), None, stop_button)
139
  gr.Markdown("Scroll down to see more images and select models.", elem_classes="guide")
140
 
141
  with gr.Column(scale=1):
@@ -153,9 +153,10 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', fill_width=True, css=CSS) as demo:
153
 
154
  for m, o in zip(current_models, output):
155
  gen_event = gr.on(triggers=[gen_button.click, txt_input.submit], fn=gen_fn,
156
- inputs=[m, txt_input, neg_input, height, width, steps, cfg, seed], outputs=[o], concurrency_limit=None)
 
157
  o.change(add_gallery, [o, m, gallery], [gallery])
158
- stop_button.click(lambda: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
159
 
160
  with gr.Column(scale=4):
161
  with gr.Accordion('Model selection'):
@@ -181,8 +182,8 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', fill_width=True, css=CSS) as demo:
181
  num_images = gr.Slider(1, max_images, value=max_images, step=1, label='Number of images')
182
  with gr.Row():
183
  gen_button2 = gr.Button('Generate', variant='primary', scale=2)
184
- stop_button2 = gr.Button('Stop', variant='stop', interactive=False, scale=1)
185
- gen_button2.click(lambda: gr.update(interactive=True), None, stop_button2)
186
 
187
  with gr.Column(scale=1):
188
  with gr.Group():
@@ -202,9 +203,10 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', fill_width=True, css=CSS) as demo:
202
  gen_event2 = gr.on(triggers=[gen_button2.click, txt_input2.submit],
203
  fn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5: gen_fn(m, t1, t2, n1, n2, n3, n4, n5) if (i < n) else None,
204
  inputs=[img_i, num_images, model_choice2, txt_input2, neg_input2,
205
- height2, width2, steps2, cfg2, seed2], outputs=[o], concurrency_limit=None)
 
206
  o.change(add_gallery, [o, model_choice2, gallery2], [gallery2])
207
- stop_button2.click(lambda: gr.update(interactive=False), None, stop_button2, cancels=[gen_event2])
208
 
209
  gr.Markdown("Based on the [TestGen](https://huggingface.co/spaces/derwahnsinn/TestGen) Space by derwahnsinn, the [SpacIO](https://huggingface.co/spaces/RdnUser77/SpacIO_v1) Space by RdnUser77 and Omnibus's Maximum Multiplier!")
210
 
 
134
  with gr.Row():
135
  gen_button = gr.Button(f'Generate up to {int(num_models)} images in up to 3 minutes total', variant='primary', scale=3)
136
  random_button = gr.Button(f'Random {int(num_models)} 🎲', variant='secondary', scale=1)
137
+ #stop_button = gr.Button('Stop', variant='stop', interactive=False, scale=1)
138
+ #gen_button.click(lambda: gr.update(interactive=True), None, stop_button)
139
  gr.Markdown("Scroll down to see more images and select models.", elem_classes="guide")
140
 
141
  with gr.Column(scale=1):
 
153
 
154
  for m, o in zip(current_models, output):
155
  gen_event = gr.on(triggers=[gen_button.click, txt_input.submit], fn=gen_fn,
156
+ inputs=[m, txt_input, neg_input, height, width, steps, cfg, seed], outputs=[o],
157
+ concurrency_limit=None, queue=False) # Be sure to delete ", queue=False" when activating the stop button
158
  o.change(add_gallery, [o, m, gallery], [gallery])
159
+ #stop_button.click(lambda: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
160
 
161
  with gr.Column(scale=4):
162
  with gr.Accordion('Model selection'):
 
182
  num_images = gr.Slider(1, max_images, value=max_images, step=1, label='Number of images')
183
  with gr.Row():
184
  gen_button2 = gr.Button('Generate', variant='primary', scale=2)
185
+ #stop_button2 = gr.Button('Stop', variant='stop', interactive=False, scale=1)
186
+ #gen_button2.click(lambda: gr.update(interactive=True), None, stop_button2)
187
 
188
  with gr.Column(scale=1):
189
  with gr.Group():
 
203
  gen_event2 = gr.on(triggers=[gen_button2.click, txt_input2.submit],
204
  fn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5: gen_fn(m, t1, t2, n1, n2, n3, n4, n5) if (i < n) else None,
205
  inputs=[img_i, num_images, model_choice2, txt_input2, neg_input2,
206
+ height2, width2, steps2, cfg2, seed2], outputs=[o],
207
+ concurrency_limit=None, queue=False) # Be sure to delete ", queue=False" when activating the stop button
208
  o.change(add_gallery, [o, model_choice2, gallery2], [gallery2])
209
+ #stop_button2.click(lambda: gr.update(interactive=False), None, stop_button2, cancels=[gen_event2])
210
 
211
  gr.Markdown("Based on the [TestGen](https://huggingface.co/spaces/derwahnsinn/TestGen) Space by derwahnsinn, the [SpacIO](https://huggingface.co/spaces/RdnUser77/SpacIO_v1) Space by RdnUser77 and Omnibus's Maximum Multiplier!")
212