feat: prevent config reset by renaming metadata_scheme to match config options

This commit is contained in:
Manuel Schmid 2024-02-03 22:41:26 +01:00
parent 63403d614e
commit 1419231e74
No known key found for this signature in database
GPG Key ID: 32C4F7569B40B84B
3 changed files with 8 additions and 8 deletions

View File

@ -373,7 +373,7 @@
"Metadata": "Metadata",
"Apply Metadata": "Apply Metadata",
"Metadata Scheme": "Metadata Scheme",
"Image Prompt parameters are not included. Use A1111 for compatibility with Civitai.": "Image Prompt parameters are not included. Use A1111 for compatibility with Civitai.",
"Fooocus (json)": "Fooocus (json)",
"A1111 (plain text)": "A1111 (plain text)"
"Image Prompt parameters are not included. Use a1111 for compatibility with Civitai.": "Image Prompt parameters are not included. Use a1111 for compatibility with Civitai.",
"fooocus (json)": "fooocus (json)",
"a1111 (plain text)": "a1111 (plain text)"
}

View File

@ -83,8 +83,8 @@ class MetadataScheme(Enum):
metadata_scheme = [
('Fooocus (json)', MetadataScheme.FOOOCUS.value),
('A1111 (plain text)', MetadataScheme.A1111.value),
(f'{MetadataScheme.FOOOCUS.value} (json)', MetadataScheme.FOOOCUS.value),
(f'{MetadataScheme.A1111.value} (plain text)', MetadataScheme.A1111.value),
]
lora_count = 5
@ -114,10 +114,10 @@ class Performance(Enum):
def list(cls) -> list:
return list(map(lambda c: c.value, cls))
def steps(self) -> int:
def steps(self) -> int | None:
return Steps[self.name].value if Steps[self.name] else None
def steps_uov(self) -> int:
def steps_uov(self) -> int | None:
return StepsUOV[self.name].value if Steps[self.name] else None

View File

@ -411,7 +411,7 @@ with shared.gradio_root:
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.')
metadata_scheme = gr.Radio(label='Metadata Scheme', choices=flags.metadata_scheme, value=modules.config.default_metadata_scheme,
info='Image Prompt parameters are not included. Use A1111 for compatibility with Civitai.',
info='Image Prompt parameters are not included. Use a1111 for compatibility with Civitai.',
visible=modules.config.default_save_metadata_to_images)
save_metadata_to_images.change(lambda x: gr.update(visible=x), inputs=[save_metadata_to_images], outputs=[metadata_scheme],