some fix for previous PRs
This commit is contained in:
parent
ad158450e3
commit
2f6ebbf876
@ -1 +1 @@
|
||||
version = '2.1.855'
|
||||
version = '2.1.856'
|
||||
|
@ -3,7 +3,7 @@ import gradio as gr
|
||||
import modules.config
|
||||
|
||||
|
||||
def load_parameter_button_click(raw_prompt_txt):
|
||||
def load_parameter_button_click(raw_prompt_txt, is_generating):
|
||||
loaded_parameter_dict = json.loads(raw_prompt_txt)
|
||||
assert isinstance(loaded_parameter_dict, dict)
|
||||
|
||||
@ -128,7 +128,11 @@ def load_parameter_button_click(raw_prompt_txt):
|
||||
results.append(gr.update())
|
||||
results.append(gr.update())
|
||||
|
||||
if is_generating:
|
||||
results.append(gr.update())
|
||||
else:
|
||||
results.append(gr.update(visible=True))
|
||||
|
||||
results.append(gr.update(visible=False))
|
||||
|
||||
for i in range(1, 6):
|
||||
|
@ -43,7 +43,7 @@ def log(img, dic):
|
||||
"</style>"
|
||||
)
|
||||
|
||||
js = (
|
||||
js = (
|
||||
"""<script>
|
||||
function to_clipboard(txt) {
|
||||
txt = decodeURIComponent(txt);
|
||||
|
19
webui.py
19
webui.py
@ -513,7 +513,9 @@ with shared.gradio_root:
|
||||
ctrls += [outpaint_selections, inpaint_input_image, inpaint_additional_prompt]
|
||||
ctrls += ip_ctrls
|
||||
|
||||
def parse_meta(raw_prompt_txt):
|
||||
state_is_generating = gr.State(False)
|
||||
|
||||
def parse_meta(raw_prompt_txt, is_generating):
|
||||
loaded_json = None
|
||||
try:
|
||||
if '{' in raw_prompt_txt:
|
||||
@ -525,13 +527,16 @@ with shared.gradio_root:
|
||||
loaded_json = None
|
||||
|
||||
if loaded_json is None:
|
||||
return gr.update(), gr.update(), gr.update(visible=False)
|
||||
if is_generating:
|
||||
return gr.update(), gr.update(), gr.update()
|
||||
else:
|
||||
return gr.update(), gr.update(visible=True), gr.update(visible=False)
|
||||
|
||||
return json.dumps(loaded_json), gr.update(visible=False), gr.update(visible=True)
|
||||
|
||||
prompt.input(parse_meta, inputs=prompt, outputs=[prompt, generate_button, load_parameter_button], queue=False, show_progress=False)
|
||||
prompt.input(parse_meta, inputs=[prompt, state_is_generating], outputs=[prompt, generate_button, load_parameter_button], queue=False, show_progress=False)
|
||||
|
||||
load_parameter_button.click(modules.meta_parser.load_parameter_button_click, inputs=prompt, outputs=[
|
||||
load_parameter_button.click(modules.meta_parser.load_parameter_button_click, inputs=[prompt, state_is_generating], outputs=[
|
||||
advanced_checkbox,
|
||||
image_number,
|
||||
prompt,
|
||||
@ -557,11 +562,13 @@ with shared.gradio_root:
|
||||
load_parameter_button
|
||||
] + lora_ctrls, queue=False, show_progress=False)
|
||||
|
||||
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), []), outputs=[stop_button, skip_button, generate_button, gallery]) \
|
||||
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), [], True),
|
||||
outputs=[stop_button, skip_button, generate_button, gallery, state_is_generating]) \
|
||||
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
||||
.then(advanced_parameters.set_all_advanced_parameters, inputs=adps) \
|
||||
.then(fn=generate_clicked, inputs=ctrls, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
||||
.then(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=False), gr.update(visible=False)), outputs=[generate_button, stop_button, skip_button]) \
|
||||
.then(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), gr.update(visible=False, interactive=False), False),
|
||||
outputs=[generate_button, stop_button, skip_button, state_is_generating]) \
|
||||
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
||||
|
||||
for notification_file in ['notification.ogg', 'notification.mp3']:
|
||||
|
Loading…
Reference in New Issue
Block a user