Compare commits

...

3 Commits

Author SHA1 Message Date
woctordho
c00516dbf3 Merge 1e4f55cc53 into 1a3ec9ea74 2026-02-26 17:52:18 +09:00
Kohya S.
1a3ec9ea74 Merge pull request #2280 from kohya-ss/fix-main-wd14-tagger-unbound-local-error
fix: rename character_tags to img_character_tags to fix UnboundLocalError
2026-02-26 08:21:42 +09:00
Kohya S
e1aedceffa fix: rename character_tags to img_character_tags to fix unboundlocalerror 2026-02-26 08:18:45 +09:00

View File

@@ -404,7 +404,7 @@ def main(args):
rating_tag = None
quality_max_prob = -1
quality_tag = None
character_tags = []
img_character_tags = []
min_thres = min(
args.thresh,
@@ -449,7 +449,7 @@ def main(args):
tag_freq[tag_name] = tag_freq.get(tag_name, 0) + 1
character_tag_text += caption_separator + tag_name
if args.character_tags_first: # we separate character tags
character_tags.append((tag_name, p))
img_character_tags.append((tag_name, p))
else:
combined_tags.append((tag_name, p))
elif (
@@ -464,9 +464,9 @@ def main(args):
# sort by probability
combined_tags.sort(key=lambda x: x[1], reverse=True)
if character_tags:
character_tags.sort(key=lambda x: x[1], reverse=True)
combined_tags = character_tags + combined_tags
if img_character_tags:
img_character_tags.sort(key=lambda x: x[1], reverse=True)
combined_tags = img_character_tags + combined_tags
combined_tags = [t[0] for t in combined_tags] # remove probability
if quality_tag is not None: