Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
@@ -74,7 +74,7 @@ with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", fill_width=True, css=css) as demo:
|
|
74 |
with gr.Row():
|
75 |
run_button = gr.Button("Generate Image", variant="primary", scale=6)
|
76 |
random_button = gr.Button("Random Model π²", variant="secondary", scale=3)
|
77 |
-
stop_button = gr.Button('Stop', variant="stop", interactive=False, scale=1)
|
78 |
with gr.Group():
|
79 |
model_name = gr.Dropdown(label="Select Model", choices=list(loaded_models.keys()), value=list(loaded_models.keys())[0], allow_custom_value=True)
|
80 |
model_info = gr.Markdown(value=get_model_info_md(list(loaded_models.keys())[0]), elem_classes="model_info")
|
@@ -120,14 +120,14 @@ with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", fill_width=True, css=css) as demo:
|
|
120 |
fn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4: infer_fn(m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4) if (i < n) else None,
|
121 |
inputs=[img_i, image_num, model_name, prompt, neg_prompt, height, width, steps, cfg, seed,
|
122 |
positive_prefix, positive_suffix, negative_prefix, negative_suffix],
|
123 |
-
outputs=[o], queue=
|
124 |
gen_event2 = gr.on(triggers=[random_button.click],
|
125 |
fn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4: infer_rand_fn(m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4) if (i < n) else None,
|
126 |
inputs=[img_i, image_num, model_name, prompt, neg_prompt, height, width, steps, cfg, seed,
|
127 |
positive_prefix, positive_suffix, negative_prefix, negative_suffix],
|
128 |
-
outputs=[o], queue=
|
129 |
o.change(save_gallery, [o, results], [results, image_files], show_api=False)
|
130 |
-
stop_button.click(lambda: gr.update(interactive=False), None, stop_button, cancels=[gen_event, gen_event2], show_api=False)
|
131 |
|
132 |
clear_prompt.click(lambda: None, None, [prompt], queue=False, show_api=False)
|
133 |
clear_results.click(lambda: (None, None), None, [results, image_files], queue=False, show_api=False)
|
|
|
74 |
with gr.Row():
|
75 |
run_button = gr.Button("Generate Image", variant="primary", scale=6)
|
76 |
random_button = gr.Button("Random Model π²", variant="secondary", scale=3)
|
77 |
+
#stop_button = gr.Button('Stop', variant="stop", interactive=False, scale=1)
|
78 |
with gr.Group():
|
79 |
model_name = gr.Dropdown(label="Select Model", choices=list(loaded_models.keys()), value=list(loaded_models.keys())[0], allow_custom_value=True)
|
80 |
model_info = gr.Markdown(value=get_model_info_md(list(loaded_models.keys())[0]), elem_classes="model_info")
|
|
|
120 |
fn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4: infer_fn(m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4) if (i < n) else None,
|
121 |
inputs=[img_i, image_num, model_name, prompt, neg_prompt, height, width, steps, cfg, seed,
|
122 |
positive_prefix, positive_suffix, negative_prefix, negative_suffix],
|
123 |
+
outputs=[o], queue=False, show_api=False) # Be sure to delete ", queue=False" when activating the stop button
|
124 |
gen_event2 = gr.on(triggers=[random_button.click],
|
125 |
fn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4: infer_rand_fn(m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4) if (i < n) else None,
|
126 |
inputs=[img_i, image_num, model_name, prompt, neg_prompt, height, width, steps, cfg, seed,
|
127 |
positive_prefix, positive_suffix, negative_prefix, negative_suffix],
|
128 |
+
outputs=[o], queue=False, show_api=False) # Be sure to delete ", queue=False" when activating the stop button
|
129 |
o.change(save_gallery, [o, results], [results, image_files], show_api=False)
|
130 |
+
#stop_button.click(lambda: gr.update(interactive=False), None, stop_button, cancels=[gen_event, gen_event2], show_api=False)
|
131 |
|
132 |
clear_prompt.click(lambda: None, None, [prompt], queue=False, show_api=False)
|
133 |
clear_results.click(lambda: (None, None), None, [results, image_files], queue=False, show_api=False)
|