Spaces:
Runtime error
Runtime error
Update webui.py
Browse files
webui.py
CHANGED
@@ -29,6 +29,8 @@ def get_task(*args):
|
|
29 |
return worker.AsyncTask(args=args)
|
30 |
|
31 |
def generate_clicked(task):
|
|
|
|
|
32 |
import ldm_patched.modules.model_management as model_management
|
33 |
|
34 |
with model_management.interrupt_processing_mutex:
|
@@ -53,7 +55,7 @@ def generate_clicked(task):
|
|
53 |
# help bad internet connection by skipping duplicated preview
|
54 |
if len(task.yields) > 0: # if we have the next item
|
55 |
if task.yields[0][0] == 'preview': # if the next item is also a preview
|
56 |
-
print('Skipped one preview for better internet connection.')
|
57 |
continue
|
58 |
|
59 |
percentage, title, image = product
|
@@ -124,6 +126,8 @@ with shared.gradio_root:
|
|
124 |
skip_button = gr.Button(label="Skip", value="Skip", elem_classes='type_row_half', visible=False)
|
125 |
stop_button = gr.Button(label="Stop", value="Stop", elem_classes='type_row_half', elem_id='stop_button', visible=False)
|
126 |
|
|
|
|
|
127 |
def stop_clicked(currentTask):
|
128 |
import ldm_patched.modules.model_management as model_management
|
129 |
currentTask.last_stop = 'stop'
|
@@ -576,6 +580,8 @@ with shared.gradio_root:
|
|
576 |
inpaint_strength, inpaint_respective_field
|
577 |
], show_progress=False, queue=False)
|
578 |
|
|
|
|
|
579 |
ctrls = [currentTask, generate_image_grid]
|
580 |
ctrls += [
|
581 |
prompt, negative_prompt, style_selections,
|
@@ -645,6 +651,8 @@ with shared.gradio_root:
|
|
645 |
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), [], True),
|
646 |
outputs=[stop_button, skip_button, generate_button, gallery, state_is_generating]) \
|
647 |
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
|
|
|
|
648 |
.then(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), gr.update(visible=False, interactive=False), False),
|
649 |
outputs=[generate_button, stop_button, skip_button, state_is_generating]) \
|
650 |
.then(fn=update_history_link, outputs=history_link) \
|
@@ -675,12 +683,12 @@ def dump_default_english_config():
|
|
675 |
|
676 |
# dump_default_english_config()
|
677 |
|
678 |
-
shared.gradio_root.launch(
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
)
|
|
|
29 |
return worker.AsyncTask(args=args)
|
30 |
|
31 |
def generate_clicked(task):
|
32 |
+
worker.AsyncTask(args=[])
|
33 |
+
|
34 |
import ldm_patched.modules.model_management as model_management
|
35 |
|
36 |
with model_management.interrupt_processing_mutex:
|
|
|
55 |
# help bad internet connection by skipping duplicated preview
|
56 |
if len(task.yields) > 0: # if we have the next item
|
57 |
if task.yields[0][0] == 'preview': # if the next item is also a preview
|
58 |
+
# print('Skipped one preview for better internet connection.')
|
59 |
continue
|
60 |
|
61 |
percentage, title, image = product
|
|
|
126 |
skip_button = gr.Button(label="Skip", value="Skip", elem_classes='type_row_half', visible=False)
|
127 |
stop_button = gr.Button(label="Stop", value="Stop", elem_classes='type_row_half', elem_id='stop_button', visible=False)
|
128 |
|
129 |
+
currentTask = gr.State(worker.AsyncTask(args=[]))
|
130 |
+
|
131 |
def stop_clicked(currentTask):
|
132 |
import ldm_patched.modules.model_management as model_management
|
133 |
currentTask.last_stop = 'stop'
|
|
|
580 |
inpaint_strength, inpaint_respective_field
|
581 |
], show_progress=False, queue=False)
|
582 |
|
583 |
+
currentTask = gr.State(worker.AsyncTask(args=[]))
|
584 |
+
|
585 |
ctrls = [currentTask, generate_image_grid]
|
586 |
ctrls += [
|
587 |
prompt, negative_prompt, style_selections,
|
|
|
651 |
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), [], True),
|
652 |
outputs=[stop_button, skip_button, generate_button, gallery, state_is_generating]) \
|
653 |
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
654 |
+
.then(fn=get_task, inputs=ctrls, outputs=currentTask) \
|
655 |
+
.then(fn=generate_clicked, inputs=currentTask, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
656 |
.then(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), gr.update(visible=False, interactive=False), False),
|
657 |
outputs=[generate_button, stop_button, skip_button, state_is_generating]) \
|
658 |
.then(fn=update_history_link, outputs=history_link) \
|
|
|
683 |
|
684 |
# dump_default_english_config()
|
685 |
|
686 |
+
shared.gradio_root.launch(
|
687 |
+
inbrowser=args_manager.args.in_browser,
|
688 |
+
server_name=args_manager.args.listen,
|
689 |
+
server_port=args_manager.args.port,
|
690 |
+
share=args_manager.args.share,
|
691 |
+
auth=check_auth if (args_manager.args.share or args_manager.args.listen) and auth_enabled else None,
|
692 |
+
allowed_paths=[modules.config.path_outputs],
|
693 |
+
blocked_paths=[constants.AUTH_FILENAME]
|
694 |
+
)
|