Clean SDXL composition tags
This commit is contained in:
+9
-2
@@ -72,6 +72,13 @@ def _pair_counts(row: dict[str, Any], root: dict[str, Any]) -> tuple[int, int]:
|
||||
return _descriptor_counts(root)
|
||||
|
||||
|
||||
def _composition_tags_text(text: str) -> str:
|
||||
text = re.sub(r"^vertical\s+", "", str(text or "").strip(), flags=re.IGNORECASE)
|
||||
text = re.sub(r"\s+composition$", "", text, flags=re.IGNORECASE)
|
||||
text = re.sub(r"\bcomposition\b", "frame", text, flags=re.IGNORECASE)
|
||||
return text.strip(" ,")
|
||||
|
||||
|
||||
def _row_explicit_signal_text(
|
||||
row: dict[str, Any],
|
||||
*,
|
||||
@@ -133,7 +140,7 @@ def row_core_tags_result(request: SDXLRowTagRequest, deps: SDXLTagRouteDependenc
|
||||
"expression",
|
||||
("Facial expressions", "Facial expression"),
|
||||
)
|
||||
composition = deps.row_value(row, "composition", ("Composition",))
|
||||
composition = _composition_tags_text(deps.row_value(row, "composition", ("Composition",)))
|
||||
for value in (
|
||||
item,
|
||||
pose,
|
||||
@@ -226,7 +233,7 @@ def hard_tags_result(request: SDXLPairTagRequest, deps: SDXLTagRouteDependencies
|
||||
hard_role = deps.clean(row.get("source_role_graph") or row.get("role_graph"))
|
||||
hard_clothing = deps.clean(root.get("hardcore_clothing_state"))
|
||||
expression = deps.clean(row.get("character_expression_text") or row.get("expression"))
|
||||
composition = deps.clean(row.get("composition"))
|
||||
composition = _composition_tags_text(deps.clean(row.get("composition")))
|
||||
for value in (
|
||||
hard_role,
|
||||
hard_item,
|
||||
|
||||
Reference in New Issue
Block a user