Skip to content

Commit

Permalink
improvements to png info
Browse files Browse the repository at this point in the history
  • Loading branch information
x-CK-x authored Sep 15, 2023
1 parent b0ce61c commit cb1fe17
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A tool for downloading from public image boards (which allow scraping) / preview

## Important Information

- the most current **STABLE** build --> [v4.4.4](https://github.com/x-CK-x/Dataset-Curation-Tool/releases/tag/v4.4.4)
- the most current **STABLE** build --> [v4.4.5](https://github.com/x-CK-x/Dataset-Curation-Tool/releases/tag/v4.4.5)
- for new users, it's highly recommended to use releases instead of pulling from the main branch
- in addition it is important to avoid using the **alpha** builds in the [releases](https://github.com/x-CK-x/Dataset-Curation-Tool/releases)
- if an alpha build is present it will be labeled as a **pre-release** and the **main-branch** of the repo is also likely to contain those changes; as such please use the most recent stable build as denoted above
Expand Down
36 changes: 32 additions & 4 deletions utils/features/captioning/PNG_Info.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,28 @@ def display_metadata(self):
tag = tag.split(":")[0]

tag = tag.replace(" ", "_")
if "_\\(" or "_(" in tag:
tag = tag.replace("_\\(", "+++++")
tag = tag.replace("_(", "+++++")

tag = tag.replace("(", "")
tag = tag.replace(")", "")

tag = tag.replace("{", "")
tag = tag.replace("}", "")
tag = tag.replace("\\n", "")
tag = tag.replace("\n", "")
tag = tag.replace("by_", "")
tag = tag.replace("art_by_", "")
tag = (tag.lower()).replace("by_", "") if "by_" in tag.lower() else tag
tag = (tag.lower()).replace("art_by_", "") if "art_by_" in tag.lower() else tag
tag = tag.replace("<lora", "")
tag = tag.replace(">", "")
tag = tag.replace("\\", "")
tag = tag.replace("BREAK", "")

if "+++++" in tag:
tag = tag.replace("+++++", "_(")
tag = f"{tag})"

# help.verbose_print(f"tag:\t{tag}")
tags.append(tag)
else:
Expand All @@ -79,14 +93,28 @@ def display_metadata(self):
tag = tag.split(":")[0]

tag = tag.replace(" ", "_")
if "_\\(" or "_(" in tag:
tag = tag.replace("_\\(", "+++++")
tag = tag.replace("_(", "+++++")

tag = tag.replace("(", "")
tag = tag.replace(")", "")

tag = tag.replace("{", "")
tag = tag.replace("}", "")
tag = tag.replace("\\n", "")
tag = tag.replace("\n", "")
tag = tag.replace("by_", "")
tag = tag.replace("art_by_", "")
tag = (tag.lower()).replace("by_", "") if "by_" in tag.lower() else tag
tag = (tag.lower()).replace("art_by_", "") if "art_by_" in tag.lower() else tag
tag = tag.replace("<lora", "")
tag = tag.replace(">", "")
tag = tag.replace("\\", "")
tag = tag.replace("BREAK", "")

if "+++++" in tag:
tag = tag.replace("+++++", "_(")
tag = f"{tag})"

# help.verbose_print(f"tag:\t{tag}")
tags.append(tag)
all_tags.append(tags)
Expand Down

0 comments on commit cb1fe17

Please sign in to comment.