Merge pull request #797 from Ancions-dot/fix_resolution
Fix Resolution Filter Showing 0 * 0pull/798/head
commit
847aec69e7
|
|
@ -155,10 +155,14 @@ def build_single_img_idx(conn, file_path, is_rebuild, safe_save_img_tag):
|
|||
meta = parsed_params.meta
|
||||
lora = parsed_params.extra.get("lora", [])
|
||||
lyco = parsed_params.extra.get("lyco", [])
|
||||
if "final_width" in meta and "final_height" in meta:
|
||||
size_str = str(meta["final_width"]) + " × " + str(meta["final_height"])
|
||||
else:
|
||||
size_str = "Unknown Size"
|
||||
pos = parsed_params.pos_prompt
|
||||
size_tag = Tag.get_or_create(
|
||||
conn,
|
||||
str(meta.get("Size-1", 0)) + " * " + str(meta.get("Size-2", 0)),
|
||||
size_str,
|
||||
type="size",
|
||||
)
|
||||
safe_save_img_tag(ImageTag(img.id, size_tag.id))
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class ComfyUIParser:
|
|||
params = None
|
||||
if not clz.test(img, file_path):
|
||||
raise Exception("The input image does not match the current parser.")
|
||||
width, height = img.size
|
||||
try:
|
||||
if is_img_created_by_comfyui_with_webui_gen_info(img):
|
||||
info = read_sd_webui_gen_info_from_image(img, file_path)
|
||||
|
|
@ -30,14 +31,20 @@ class ComfyUIParser:
|
|||
else:
|
||||
params = get_comfyui_exif_data(img)
|
||||
info = comfyui_exif_data_to_str(params)
|
||||
except Exception as e:
|
||||
logger.error('parse comfyui image failed. prompt:')
|
||||
logger.error(img.info.get('prompt'))
|
||||
return ImageGenerationInfo()
|
||||
except Exception as e:
|
||||
logger.error("parse comfyui image failed. prompt:")
|
||||
logger.error(img.info.get("prompt"))
|
||||
return ImageGenerationInfo(
|
||||
params=ImageGenerationParams(
|
||||
meta={"final_width": width, "final_height": height}
|
||||
)
|
||||
)
|
||||
return ImageGenerationInfo(
|
||||
info,
|
||||
ImageGenerationParams(
|
||||
meta=params["meta"], pos_prompt=params["pos_prompt"], extra=params
|
||||
meta=params["meta"] | {"final_width": width, "final_height": height},
|
||||
pos_prompt=params["pos_prompt"],
|
||||
extra=params,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,11 @@ class FooocusParser:
|
|||
return ImageGenerationInfo(
|
||||
info,
|
||||
ImageGenerationParams(
|
||||
meta=params["meta"],
|
||||
meta=params["meta"]
|
||||
| {
|
||||
"final_width": img.size[0],
|
||||
"final_height": img.size[1],
|
||||
},
|
||||
pos_prompt=parse_generation_parameters(info)["pos_prompt"],
|
||||
extra={
|
||||
"lora": unique_by(lora_list, lambda x: x["name"].lower())
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ class InvokeAIParser:
|
|||
return ImageGenerationInfo(
|
||||
info,
|
||||
ImageGenerationParams(
|
||||
meta=meta_obj,
|
||||
meta=meta_obj
|
||||
| {"final_width": img.size[0], "final_height": img.size[1]},
|
||||
pos_prompt=parse_generation_parameters(info)["pos_prompt"],
|
||||
# extra=params
|
||||
),
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@ class NovelAIParser:
|
|||
return ImageGenerationInfo(
|
||||
info,
|
||||
ImageGenerationParams(
|
||||
meta=params["meta"], pos_prompt=params["pos_prompt"]
|
||||
meta=params["meta"]
|
||||
| {"final_width": img.size[0], "final_height": img.size[1]},
|
||||
pos_prompt=params["pos_prompt"],
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,14 +16,21 @@ class SdWebUIParser:
|
|||
if not clz.test(img, file_path):
|
||||
raise Exception("The input image does not match the current parser.")
|
||||
info = read_sd_webui_gen_info_from_image(img, file_path)
|
||||
width, height = img.size
|
||||
if not info:
|
||||
return ImageGenerationInfo()
|
||||
return ImageGenerationInfo(
|
||||
params=ImageGenerationParams(
|
||||
meta={"final_width": width, "final_height": height}
|
||||
)
|
||||
)
|
||||
info += ", Source Identifier: Stable Diffusion web UI"
|
||||
params = parse_generation_parameters(info)
|
||||
return ImageGenerationInfo(
|
||||
info,
|
||||
ImageGenerationParams(
|
||||
meta=params["meta"], pos_prompt=params["pos_prompt"], extra=params
|
||||
meta=params["meta"] | {"final_width": width, "final_height": height},
|
||||
pos_prompt=params["pos_prompt"],
|
||||
extra=params,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,10 @@ class SdWebUIStealthParser:
|
|||
return ImageGenerationInfo(
|
||||
info,
|
||||
ImageGenerationParams(
|
||||
meta=params["meta"], pos_prompt=params["pos_prompt"], extra=params
|
||||
meta=params["meta"]
|
||||
| {"final_width": img.size[0], "final_height": img.size[1]},
|
||||
pos_prompt=params["pos_prompt"],
|
||||
extra=params,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,10 @@ class StableSwarmUIParser:
|
|||
return ImageGenerationInfo(
|
||||
info,
|
||||
ImageGenerationParams(
|
||||
meta=params["meta"], pos_prompt=params["pos_prompt"], extra=params
|
||||
meta=params["meta"]
|
||||
| {"final_width": img.size[0], "final_height": img.size[1]},
|
||||
pos_prompt=params["pos_prompt"],
|
||||
extra=params,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue