use state_is_generating for preset selection change

This commit is contained in:
Manuel Schmid 2024-01-01 18:39:55 +01:00
parent 9d8881d052
commit 55bb233a3e
No known key found for this signature in database
GPG Key ID: 32C4F7569B40B84B
1 changed files with 5 additions and 5 deletions

View File

@ -464,7 +464,9 @@ with shared.gradio_root:
model_refresh.click(model_refresh_clicked, [], [base_model, refiner_model, preset_selection] + lora_ctrls,
queue=False, show_progress=False)
def preset_selection_change(preset):
state_is_generating = gr.State(False)
def preset_selection_change(preset, is_generating):
preset_content = modules.config.try_get_preset_content(preset) if preset != 'initial' else {}
preset_prepared = modules.meta_parser.parse_meta_from_preset(preset_content)
@ -473,9 +475,9 @@ with shared.gradio_root:
launch.lora_downloads = preset_prepared['lora_downloads']
launch.download_models()
return modules.meta_parser.load_parameter_button_click(json.dumps(preset_prepared))
return modules.meta_parser.load_parameter_button_click(json.dumps(preset_prepared), is_generating)
preset_selection.change(preset_selection_change, inputs=preset_selection, outputs=[
preset_selection.change(preset_selection_change, inputs=[preset_selection, state_is_generating], outputs=[
advanced_checkbox,
image_number,
prompt,
@ -561,8 +563,6 @@ with shared.gradio_root:
ctrls += [outpaint_selections, inpaint_input_image, inpaint_additional_prompt]
ctrls += ip_ctrls
state_is_generating = gr.State(False)
def parse_meta(raw_prompt_txt, is_generating):
loaded_json = None
try: