forked from extern/easydiffusion
Add tiling and latent upscaler steps to metadata
Also fix txt metadata labels when also embedding metadata
This commit is contained in:
parent
edd92b724f
commit
69d937e0b1
@ -30,9 +30,11 @@ TASK_TEXT_MAPPING = {
|
||||
"lora_alpha": "LoRA Strength",
|
||||
"use_hypernetwork_model": "Hypernetwork model",
|
||||
"hypernetwork_strength": "Hypernetwork Strength",
|
||||
"tiling": "Seamless Tiling",
|
||||
"use_face_correction": "Use Face Correction",
|
||||
"use_upscale": "Use Upscaling",
|
||||
"upscale_amount": "Upscale By",
|
||||
"latent_upscaler_steps": "Latent Upscaler Steps"
|
||||
}
|
||||
|
||||
time_placeholders = {
|
||||
@ -169,21 +171,23 @@ def save_images_to_disk(images: list, filtered_images: list, req: GenerateImageR
|
||||
output_quality=task_data.output_quality,
|
||||
output_lossless=task_data.output_lossless,
|
||||
)
|
||||
if task_data.metadata_output_format.lower() in ["json", "txt", "embed"]:
|
||||
save_dicts(
|
||||
metadata_entries,
|
||||
save_dir_path,
|
||||
file_name=make_filter_filename,
|
||||
output_format=task_data.metadata_output_format,
|
||||
file_format=task_data.output_format,
|
||||
)
|
||||
if task_data.metadata_output_format:
|
||||
for metadata_output_format in task_data.metadata_output_format.split(","):
|
||||
if metadata_output_format.lower() in ["json", "txt", "embed"]:
|
||||
save_dicts(
|
||||
metadata_entries,
|
||||
save_dir_path,
|
||||
file_name=make_filter_filename,
|
||||
output_format=task_data.metadata_output_format,
|
||||
file_format=task_data.output_format,
|
||||
)
|
||||
|
||||
|
||||
def get_metadata_entries_for_request(req: GenerateImageRequest, task_data: TaskData):
|
||||
metadata = get_printable_request(req, task_data)
|
||||
|
||||
# if text, format it in the text format expected by the UI
|
||||
is_txt_format = task_data.metadata_output_format.lower() == "txt"
|
||||
is_txt_format = task_data.metadata_output_format and "txt" in task_data.metadata_output_format.lower().split(",")
|
||||
if is_txt_format:
|
||||
metadata = {TASK_TEXT_MAPPING[key]: val for key, val in metadata.items() if key in TASK_TEXT_MAPPING}
|
||||
|
||||
@ -215,10 +219,12 @@ def get_printable_request(req: GenerateImageRequest, task_data: TaskData):
|
||||
del metadata["hypernetwork_strength"]
|
||||
if task_data.use_lora_model is None and "lora_alpha" in metadata:
|
||||
del metadata["lora_alpha"]
|
||||
if task_data.use_upscale is not "latent_upscaler" and "latent_upscaler_steps" in metadata:
|
||||
del metadata["latent_upscaler_steps"]
|
||||
|
||||
app_config = app.getConfig()
|
||||
if not app_config.get("test_diffusers", False):
|
||||
for key in (x for x in ["use_lora_model", "lora_alpha", "clip_skip"] if x in metadata):
|
||||
for key in (x for x in ["use_lora_model", "lora_alpha", "clip_skip", "tiling", "latent_upscaler_steps"] if x in metadata):
|
||||
del metadata[key]
|
||||
|
||||
return metadata
|
||||
|
@ -35,6 +35,7 @@ const SETTINGS_IDS_LIST = [
|
||||
"gfpgan_model",
|
||||
"use_upscale",
|
||||
"upscale_amount",
|
||||
"latent_upscaler_steps",
|
||||
"block_nsfw",
|
||||
"show_only_filtered_image",
|
||||
"upscale_model",
|
||||
|
@ -221,6 +221,14 @@ const TASK_MAPPING = {
|
||||
readUI: () => upscaleAmountField.value,
|
||||
parse: (val) => val,
|
||||
},
|
||||
latent_upscaler_steps: {
|
||||
name: "Latent Upscaler Steps",
|
||||
setUI: (latent_upscaler_steps) => {
|
||||
latentUpscalerStepsField.value = latent_upscaler_steps
|
||||
},
|
||||
readUI: () => latentUpscalerStepsField.value,
|
||||
parse: (val) => val,
|
||||
},
|
||||
sampler_name: {
|
||||
name: "Sampler",
|
||||
setUI: (sampler_name) => {
|
||||
|
Loading…
Reference in New Issue
Block a user