mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
feat: add config and checkbox for save_metadata_to_images
This commit is contained in:
@@ -141,6 +141,7 @@ def worker():
|
|||||||
inpaint_input_image = args.pop()
|
inpaint_input_image = args.pop()
|
||||||
inpaint_additional_prompt = args.pop()
|
inpaint_additional_prompt = args.pop()
|
||||||
inpaint_mask_image_upload = args.pop()
|
inpaint_mask_image_upload = args.pop()
|
||||||
|
save_metadata_to_images = args.pop()
|
||||||
|
|
||||||
cn_tasks = {x: [] for x in flags.ip_list}
|
cn_tasks = {x: [] for x in flags.ip_list}
|
||||||
for _ in range(4):
|
for _ in range(4):
|
||||||
@@ -839,8 +840,8 @@ def worker():
|
|||||||
}
|
}
|
||||||
cn_task_index += 1
|
cn_task_index += 1
|
||||||
|
|
||||||
metadata |= {'software': f'Fooocus v{fooocus_version.version}'}
|
metadata |= {'software': f'Fooocus v{fooocus_version.version}'}
|
||||||
metadata_string = json.dumps(metadata, ensure_ascii=False)
|
metadata_string = json.dumps(metadata, ensure_ascii=False)
|
||||||
|
|
||||||
for x in imgs:
|
for x in imgs:
|
||||||
d = [
|
d = [
|
||||||
@@ -867,7 +868,7 @@ def worker():
|
|||||||
if n != 'None':
|
if n != 'None':
|
||||||
d.append((f'LoRA {li + 1}', f'{n} : {w}'))
|
d.append((f'LoRA {li + 1}', f'{n} : {w}'))
|
||||||
d.append(('Version', 'v' + fooocus_version.version))
|
d.append(('Version', 'v' + fooocus_version.version))
|
||||||
log(x, d, metadata_string, True)
|
log(x, d, metadata_string, save_metadata_to_images)
|
||||||
|
|
||||||
yield_result(async_task, imgs, do_not_show_finished_images=len(tasks) == 1)
|
yield_result(async_task, imgs, do_not_show_finished_images=len(tasks) == 1)
|
||||||
except ldm_patched.modules.model_management.InterruptProcessingException as e:
|
except ldm_patched.modules.model_management.InterruptProcessingException as e:
|
||||||
|
|||||||
@@ -315,6 +315,11 @@ example_inpaint_prompts = get_config_item_or_set_default(
|
|||||||
],
|
],
|
||||||
validator=lambda x: isinstance(x, list) and all(isinstance(v, str) for v in x)
|
validator=lambda x: isinstance(x, list) and all(isinstance(v, str) for v in x)
|
||||||
)
|
)
|
||||||
|
default_save_metadata_to_images = get_config_item_or_set_default(
|
||||||
|
key='default_save_metadata_to_images',
|
||||||
|
default_value=False,
|
||||||
|
validator=lambda x: isinstance(x, bool)
|
||||||
|
)
|
||||||
|
|
||||||
example_inpaint_prompts = [[x] for x in example_inpaint_prompts]
|
example_inpaint_prompts = [[x] for x in example_inpaint_prompts]
|
||||||
|
|
||||||
@@ -334,6 +339,7 @@ possible_preset_keys = [
|
|||||||
"default_prompt_negative",
|
"default_prompt_negative",
|
||||||
"default_styles",
|
"default_styles",
|
||||||
"default_aspect_ratio",
|
"default_aspect_ratio",
|
||||||
|
"default_save_metadata_to_images",
|
||||||
"checkpoint_downloads",
|
"checkpoint_downloads",
|
||||||
"embeddings_downloads",
|
"embeddings_downloads",
|
||||||
"lora_downloads",
|
"lora_downloads",
|
||||||
|
|||||||
@@ -381,6 +381,8 @@ with shared.gradio_root:
|
|||||||
info='Set as negative number to disable. For developer debugging.')
|
info='Set as negative number to disable. For developer debugging.')
|
||||||
disable_preview = gr.Checkbox(label='Disable Preview', value=False,
|
disable_preview = gr.Checkbox(label='Disable Preview', value=False,
|
||||||
info='Disable preview during generation.')
|
info='Disable preview during generation.')
|
||||||
|
save_metadata_to_images = gr.Checkbox(label='Save Metadata to Images', value=modules.config.default_save_metadata_to_images,
|
||||||
|
info='Adds parameters to generated images allowing manual regeneration.')
|
||||||
|
|
||||||
with gr.Tab(label='Control'):
|
with gr.Tab(label='Control'):
|
||||||
debugging_cn_preprocessor = gr.Checkbox(label='Debug Preprocessors', value=False,
|
debugging_cn_preprocessor = gr.Checkbox(label='Debug Preprocessors', value=False,
|
||||||
@@ -528,6 +530,7 @@ with shared.gradio_root:
|
|||||||
ctrls += [input_image_checkbox, current_tab]
|
ctrls += [input_image_checkbox, current_tab]
|
||||||
ctrls += [uov_method, uov_input_image]
|
ctrls += [uov_method, uov_input_image]
|
||||||
ctrls += [outpaint_selections, inpaint_input_image, inpaint_additional_prompt, inpaint_mask_image]
|
ctrls += [outpaint_selections, inpaint_input_image, inpaint_additional_prompt, inpaint_mask_image]
|
||||||
|
ctrls += [save_metadata_to_images]
|
||||||
ctrls += ip_ctrls
|
ctrls += ip_ctrls
|
||||||
|
|
||||||
state_is_generating = gr.State(False)
|
state_is_generating = gr.State(False)
|
||||||
|
|||||||
Reference in New Issue
Block a user