Spaces:
Runtime error
Runtime error
Update webui.py
Browse files
webui.py
CHANGED
@@ -642,16 +642,33 @@ with shared.gradio_root:
|
|
642 |
metadata_import_button.click(trigger_metadata_import, inputs=[metadata_input_image, state_is_generating], outputs=load_data_outputs, queue=False, show_progress=True) \
|
643 |
.then(style_sorter.sort_styles, inputs=style_selections, outputs=style_selections, queue=False, show_progress=False)
|
644 |
|
645 |
-
|
646 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
647 |
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
648 |
-
.then(fn=
|
649 |
.then(fn=generate_clicked, inputs=currentTask, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
650 |
-
.then(lambda: (
|
651 |
-
|
|
|
|
|
|
|
|
|
652 |
.then(fn=update_history_link, outputs=history_link) \
|
653 |
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
654 |
|
|
|
|
|
|
|
|
|
655 |
for notification_file in ['notification.ogg', 'notification.mp3']:
|
656 |
if os.path.exists(notification_file):
|
657 |
gr.Audio(interactive=False, value=notification_file, elem_id='audio_notification', visible=False)
|
@@ -677,9 +694,6 @@ def dump_default_english_config():
|
|
677 |
|
678 |
# dump_default_english_config()
|
679 |
|
680 |
-
# Ketika launch(), currentTask dinonaktifkan
|
681 |
-
currentTask.set(None)
|
682 |
-
|
683 |
shared.gradio_root.launch(
|
684 |
inbrowser=args_manager.args.in_browser,
|
685 |
server_name=args_manager.args.listen,
|
@@ -689,7 +703,3 @@ shared.gradio_root.launch(
|
|
689 |
allowed_paths=[modules.config.path_outputs],
|
690 |
blocked_paths=[constants.AUTH_FILENAME],
|
691 |
)
|
692 |
-
|
693 |
-
# Ketika tombol diklik, currentTask diaktifkan
|
694 |
-
generate_button.click(lambda: (currentTask.set(worker.AsyncTask(args=[])), gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), [], True),
|
695 |
-
outputs=[stop_button, skip_button, generate_button, gallery, state_is_generating])
|
|
|
642 |
metadata_import_button.click(trigger_metadata_import, inputs=[metadata_input_image, state_is_generating], outputs=load_data_outputs, queue=False, show_progress=True) \
|
643 |
.then(style_sorter.sort_styles, inputs=style_selections, outputs=style_selections, queue=False, show_progress=False)
|
644 |
|
645 |
+
# Inisialisasi currentTask menjadi None saat diluncurkan
|
646 |
+
currentTask = None
|
647 |
+
|
648 |
+
# Saat tombol Generate diklik
|
649 |
+
generate_button.click(lambda: (
|
650 |
+
gr.update(visible=True, interactive=True),
|
651 |
+
gr.update(visible=True, interactive=True),
|
652 |
+
gr.update(visible=False, interactive=False),
|
653 |
+
[],
|
654 |
+
True),
|
655 |
+
outputs=[stop_button, skip_button, generate_button, gallery, state_is_generating]) \
|
656 |
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
657 |
+
.then(fn=set_current_task, outputs=currentTask) \
|
658 |
.then(fn=generate_clicked, inputs=currentTask, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
659 |
+
.then(lambda: (
|
660 |
+
gr.update(visible=True, interactive=True),
|
661 |
+
gr.update(visible=False, interactive=False),
|
662 |
+
gr.update(visible=False, interactive=False),
|
663 |
+
False),
|
664 |
+
outputs=[generate_button, stop_button, skip_button, state_is_generating]) \
|
665 |
.then(fn=update_history_link, outputs=history_link) \
|
666 |
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
667 |
|
668 |
+
def set_current_task():
|
669 |
+
global currentTask
|
670 |
+
currentTask = gr.State(worker.AsyncTask(args=[]))
|
671 |
+
|
672 |
for notification_file in ['notification.ogg', 'notification.mp3']:
|
673 |
if os.path.exists(notification_file):
|
674 |
gr.Audio(interactive=False, value=notification_file, elem_id='audio_notification', visible=False)
|
|
|
694 |
|
695 |
# dump_default_english_config()
|
696 |
|
|
|
|
|
|
|
697 |
shared.gradio_root.launch(
|
698 |
inbrowser=args_manager.args.in_browser,
|
699 |
server_name=args_manager.args.listen,
|
|
|
703 |
allowed_paths=[modules.config.path_outputs],
|
704 |
blocked_paths=[constants.AUTH_FILENAME],
|
705 |
)
|
|
|
|
|
|
|
|