Git Product home page Git Product logo

sd-webui-easy-tag-insert's Introduction

SD Webui Easy Tag Insert

This is an Extension for the Automatic1111 Webui, which trivializes inserting prompts.

Also compatible with Forge!


(Catppuccin Theme)

Notice

This Extension has been updated to work for the latest version of the Webui. If you're using an older version, please check out Releases.

How to Use

This Extension creates buttons in a new Extra Networks tab, EZ Tags. When clicked, it will add the specified string into either the Positive or Negative prompt field.

Use Cases

You can use this Extension to simply make shortcuts for very long prompts:

Starting Prompts:
  Positive: (high quality, best quality)
  Negative: (low quality, worst quality:1.2)

This is really useful with LoRAs, especially for those that contain multiple concepts with different trigger words.

Character:
  Chara1: triggers1, <lora:franchise:0.75>
  Chara2: triggers2, <lora:franchise:0.75>

How to Add Entries

The tags are loaded from the .yml files inside the tags folder. To add your own entry, write in the following format:

Category:
  Display Name: Actual Prompts

Those are 2 spaces at the beginning of each entry, as specified by YAML

Note

  • If no tags folder is present (eg. fresh install), it will automatically clone the samples folder to tags. This is to avoid overriding users' local files.
  • An example .yml file is also provided
  • The Show dirs toggle displays the Categories for filtering
  • You can have multiple .yml files in the tags folder for better organizations
  • You can also have the same Category in multiple files
  • You can live reload the entries by pressing Refresh without restarting the UI

    To avoid race condition, Refresh can only be triggered once per second

  • Nested categories are also supported

Sorting

  • Default Sort: First by Category, then by Display Name
  • Date Created: By Index (the order they are written in the YAML)
  • Date Modified: First by Category, then by Index
  • Name: By Display Name

Due to how the Webui is coded, the buttons are sorted like Date Created on launch

sd-webui-easy-tag-insert's People

Contributors

haoming02 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sd-webui-easy-tag-insert's Issues

Error appearing in A1111 UI after installing EZ Tags

Hi, I just added this to A1111 via Extensions > Install from URL, I stopped A1111 totally, closed the UI, hacked together a starting YAML file and restarted and I encountered an error when opening ANY of the Extra Networks tabs:

Current branch is not master. Running git pull from dev.
From https://github.com/AUTOMATIC1111/stable-diffusion-webui
 * branch              dev        -> FETCH_HEAD
Already up to date.

venv "S:\GenAI\ImageGen\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: v1.6.0-469-gf92d6149
Commit hash: f92d61497a426a19818625c3ccdaae9beeb82b31

Launching Web UI with arguments: --data-dir=S:\GenAI\ImageGen\data --ckpt-dir=S:\GenAI\ImageGen\data\models\Checkpoints --vae-dir=S:\GenAI\ImageGen\data\models\VAE --clip-models-path=S:\GenAI\ImageGen\data\models\clip --embeddings-dir=S:\GenAI\ImageGen\data\models\embeddings --styles-file=S:\GenAI\ImageGen\data\styles*.csv --enable-insecure-extension-access --listen --no-half-vae --theme=dark --xformers

Loading weights [15012c538f] from S:\GenAI\ImageGen\data\models\Checkpoints\realisticVisionV51_v51VAE.safetensors
Creating model from config: S:\GenAI\ImageGen\stable-diffusion-webui\configs\v1-inference.yaml
Running on local URL:  http://0.0.0.0:7860

Applying attention optimization: xformers... done.
Model loaded in 6.3s (load weights from disk: 2.1s, create model: 1.2s, apply weights to model: 2.3s, move model to device: 0.1s, load textual inversion embeddings: 0.2s, calculate empty prompt: 0.2s).

To create a public link, set `share=True` in `launch()`.
Startup time: 38.0s (initial startup: 0.1s, prepare environment: 10.8s, import torch: 6.3s, import gradio: 2.1s, setup paths: 1.6s, initialize shared: 0.6s, other imports: 1.3s, setup codeformer: 0.5s, load scripts: 6.5s, create ui: 2.8s, gradio launch: 5.4s).

Traceback (most recent call last):
  File "S:\GenAI\ImageGen\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "S:\GenAI\ImageGen\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "S:\GenAI\ImageGen\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "S:\GenAI\ImageGen\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "S:\GenAI\ImageGen\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "S:\GenAI\ImageGen\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "S:\GenAI\ImageGen\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "S:\GenAI\ImageGen\stable-diffusion-webui\modules\ui_extra_networks.py", line 419, in pages_html
    return refresh()
  File "S:\GenAI\ImageGen\stable-diffusion-webui\modules\ui_extra_networks.py", line 427, in refresh
    ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]
  File "S:\GenAI\ImageGen\stable-diffusion-webui\modules\ui_extra_networks.py", line 427, in <listcomp>
    ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]
  File "S:\GenAI\ImageGen\data\extensions\sd-webui-easy-tag-insert\scripts\eztags.py", line 90, in create_html
    items_html += self.create_html_for_item(item, tabname)
  File "S:\GenAI\ImageGen\data\extensions\sd-webui-easy-tag-insert\scripts\eztags.py", line 47, in create_html_for_item
    onclick = '"' + html.escape(f"""return cardClicked({quote_js(tabname)}, {quote_js(item["prompt"].strip())}, "true")""") + '"'
AttributeError: 'dict' object has no attribute 'strip'

Update?

Simple question, will be update for new A1111? Its bugged and not working.

Whole extension Folder gets cleansed

Added the default tags that come with this extension in a new Folder and created my own folder structure with tags.
But this extension Cleanse the whole extension Folder, that's always a bad way to delete all the saved tags of the user.
if it's an user error, cleanse the whole folder is still just bad.
Even if you handle this extension correct, 1 misstake and it cleanse all your tags.

Categories are not created.

I assumed that subcategories (folders) would be created that would be displayed in the folder view frame, but all the cards are added to the root folder, so if I have a lot of styles it is impossible to filter them.

How to reproduce:
Use styles from example

Starting Prompts:
  Positive: (high quality, best quality)
  Negative: (low quality, worst quality:1.2)

Subject:
  1 girl: 1girl, solo
  2 girls: 2girls, multiple_girls
  1 boy: 1boy, solo
  Dog: dog
  Cat: cat

Style:
  2D:
    Sketch: sketch, drawing, detailed, pencil, black and white
    Anime: absurdres, official_art, key_visual, anime
  3D:
    Animal: wildlife photography, photograph, wildlife, soft focus, 4k, national geographic
    Digital: ultra realistic, concept art, intricate details, highly detailed, photorealistic, sharp focus, volumetric lighting, unreal engine

Expected Result:
Folders "Starting Prompts", "Subject", "Style", "Style/2D", "Style/3D"

Actual result:
Cards named like "Starting Prompts---Positive", "Style--2D___Sketch" in root folder

Please give some examples

Hi, thanks for your extension. It's really interesting. I'm sorry, but I don't understand, how to add tags. Could you please add some examples to your manual. Ex.: I have lora with these triggers: perfect hands. How can I use them with youe extension? Where can I find the button (which you wrote).
Thank you

EASY TAG randomly stoped working

I've had everything set up the same way for a long time and (I think) since the SD update I've had this problem:

*** Error executing callback before_ui for C:\Users\AdziOo\stable-diffusion-webui\extensions\sd-webui-easy-tag-insert\scripts\eztags.py
Traceback (most recent call last):
File "C:\Users\AdziOo\stable-diffusion-webui\modules\script_callbacks.py", line 280, in before_ui_callback
c.callback()
File "C:\Users\AdziOo\stable-diffusion-webui\extensions\sd-webui-easy-tag-insert\scripts\eztags.py", line 113, in registerTab
yaml_utils.reload_yaml()
File "C:\Users\AdziOo\stable-diffusion-webui\extensions\sd-webui-easy-tag-insert\scripts\yaml_utils.py", line 41, in reload_yaml
TAGS = merge_dictionary(TAGS, yaml.safe_load(stream))
File "C:\Users\AdziOo\stable-diffusion-webui\venv\lib\site-packages\ruamel\yaml\main.py", line 1105, in safe_load
error_deprecation('safe_load', 'load', arg="typ='safe', pure=True")
File "C:\Users\AdziOo\stable-diffusion-webui\venv\lib\site-packages\ruamel\yaml\main.py", line 1039, in error_deprecation
raise AttributeError(s, name=None)
AttributeError:
"safe_load()" has been removed, use

yaml = YAML(typ='safe', pure=True)
yaml.load(...)

instead of file "C:\Users\AdziOo\stable-diffusion-webui\extensions\sd-webui-easy-tag-insert\scripts\yaml_utils.py", line 41

TAGS = merge_dictionary(TAGS, yaml.safe_load(stream))

Any idea?

Make tag sub-categories as "subdirs" rather than prefixes on card names

UI enhancement request:

Take this example YAML, where Cats and Dogs are sub-categories of Pets:

Pets:
  Cats:
    Garfield: A cute oversized orange tomcat with black stripes
    Nermal: A cute grey kitten
  Dogs:
    Odie: A yellow dog with long tongue
People:
  Jon: A middle aged man with short brown curly hair

The effect of nesting tags in the YAML is that only the top-level categories (Pets and People) are shown as "subdirs" within the ribbon above the cards, with the sub-categories pre-fixed to the tag name on the actual "card":

[all] [Pets] [People]

[Cats/Garfield] [Cats/Nermal] [Dogs/Odie] [Jon]

This makes it slightly harder to read the cards/find tags. When the sub-categories are longer than a few characters the end of the tag name is cropped at the right hand end of the card. I was hoping that the sub-categories would be suffixed to the parent category. In other words, what I would prefer to see is:

[all] [Pets/Cats] [Pets/Dogs] [People]

[Garfield] [Nermal] [Odie] [Jon]

This behavior is similar to what happens in other Extra Networks, such as LoRAs, when they are organized into sub-dirs.

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.