Giter VIP home page Giter VIP logo

a1111-sd-webui-tagcomplete's Introduction

Booru tag autocompletion for A1111

This custom script serves as a drop-in extension for the popular AUTOMATIC1111 web UI for Stable Diffusion.

It displays autocompletion hints for recognized tags from "image booru" boards such as Danbooru, which are primarily used for browsing Anime-style illustrations. Since some Stable Diffusion models were trained using this information, for example Waifu Diffusion, using exact tags in prompts can often improve composition and help to achieve a wanted look.

I created this script as a convenience tool since it reduces the need of switching back and forth between the web UI and a booru site to copy-paste tags.

You can either download the files manually as described below, or use a pre-packaged version from Releases.

Disclaimer:

This script is definitely not optimized, and it's not very intelligent. The tags are simply recommended based on their natural order in the CSV, which is their respective image count for the default Danbooru tag list. Also, at least for now, neither keyboard selection for tags nor completion for negative or img2img prompt textboxes is supported, and there's no way to turn the feature off from the ui, but I plan to get around to those features eventually.

Screenshots

Demo video

ac_demo.mp4

Dark and Light mode supported, including tag colors:

tagtypes tagtypes_light

Installation

Simply put tagAutocomplete.js into the javascript folder of your web UI installation. It will run automatically the next time the web UI is started. For the script to work, you also need to download the tags folder from this repo and paste it and its contents into the web UI root, or create them there manually.

The tags folder contains two files: config.json and danbooru.csv. This is the data the script uses for autocompletion.

Config

The config contains the following settings and defaults:

{
	"tagFile": "danbooru.csv",
	"maxResults": 5,
	"replaceUnderscores": true
}
Setting Description
tagFile Specifies the tag file to use. You can provide a custom tag database of your liking, but since the script was developed with Danbooru tags in mind, it might not work properly with other configurations.
maxResults How many results to show max. For the default tag set, the results are ordered by occurence count.
replaceUnderscores If true, undescores are replaced with spaces on clicking a tag. Might work better for some models.

CSV tag data

The script expects a CSV file with tags saved in the following way:

1girl,0
solo,0
highres,5
long_hair,0

Notably, it does not expect column names in the first row. The first value needs to be the tag name, while the second value specifies the tag type. The numbering system follows the tag API docs of Danbooru:

Value Description
0 General
1 Artist
3 Copyright
4 Character
5 Meta

The tag type is used for coloring entries in the result list.

a1111-sd-webui-tagcomplete's People

Contributors

dominikdoom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.