Skip to content

dr413677671/PromptGallery-stable-diffusion-webui

Repository files navigation

Forks Stargazers Issues


Logo

Prompt Gallery

A prompt cookbook worked as stable-diffusion-webui extenstions.
Watch Demo »

Explore the docs · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. Contact
  6. Acknowledgments

About The Project

Please star the repo if you likes it :>

🐘 Good news: the extension now support webui dark theme.

Prompt Gallery works as a prompt-set library extension of stable-diffusion-webui. Stable-diffusion is an AI model which can generate illustration based on text-based prompts

The extension combined with four features:

  1. prompt-set library management
  2. preview pictures management
  3. select a combination of prompt-sets and generate illustration in webui
  4. avatar/character system

(back to top)

Getting Started

Prerequisites & Installation

  1. Install stable-diffusion-webui

  2. Edit webui-user.bat (Win) or webui-user.sh (Linux) with these arguments "--api --listen --cors-allow-origins http://localhost:5173"

install

  1. Start webui

  2. Install Prompt-gallery extension in Web-UI

4.1 Inout https://github.com/dr413677671/PromptGallery-stable-diffusion-webui.git in "URL for extension's git repository"

4.2 Input "Prompt Gallery" in Local directory name

install

Please refer to section Customized extension ip and port (optional) if you are using customized webui ip/port.

Usage

Restart webui. You should see a initial frontpage like this.

preset

There is no preview pictures. Prompt Gallery works like a framework. You need to create your own prompt-set library folloting by two steps:

  1. edit your prompt-set dictionary
  2. generate preview pictures for prompt-sets

Please follow the instructions below to build your own prompt-set library: Alternatively you could watch the video tutorial: View Demo

Build prompt-set library

Definition of avatars.yaml:

value negative param
Positive prompts Negative prompts Other params for webui image generation

Build Avatar library

Avatars is the charater displayed on the top of the extension. Defined your own character by editing /extensions/your-prompt-gallery-extension-name/assets/avatars.yaml

The field "value" is the prompt-set for each characters.

Teamplate:

 whiteHair: 
   value: "1 girl,  blush, White hair, Red eyes, animal ears,  looking at viewer, gothic lolita, dramatic angle, very beautiful, beautiful eyes, "
   negative: ""
 pinkGirl: 
   value: "petite, 1girl, solo, pink hair, very long hair, school uniform, happy,outdoors, flower field, excited"

Build prompt-set library

Prompt-sets are prompts displayed as cart boxes below.

Customized your own prompt-set by editing /extensions/your-prompt-gallery-extension-name/assets/tags.yaml

    category-tier-1:
      category-tier-1-1:
        "prompt-set-name-1":
          value: "prompt1, prompt2"
          negative: "neg-prompt1, neg-prompt2"
        "prompt-set-name-2"
          value: "prompt1"
          negative: "neg-prompt1"
      category-tier-1-2:
        "prompt-set-name-3":
          value: "prompts"

The prompt-set are managed hierarchyly (e.g. the config below defined a tier 1 category "Figure" containes two tier two categories "Hair" and "Face")

 Figure:
   Hair:
     "ponny-tail":
       value: "ponny-tail"
       negative: "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, "
     "short_hair"
       value: "short_hair"
       negative: "long_hair,lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, "
   Face:
     "smile":
       value: "smile"

 Background:
   '':
     simple background:
       value: simple background
     sunburst background:
       value: sunburst background
   Nature:
     Space:
       value: "space background, space,"
     Startrails:
       value: colorful startrails
     Woods:
       value: "Woods background, fantacy background,"

Additionally you could edit field "param" to customized AI model parameters (or switch models using the webui model selection tab.):

 Style:
   General Effect:
     "General_ice_high_res":
       value: "flowing ice, portrait, focus on face, complex, extremely detailed , elegant, CG, (an extremely delicate and beautiful girl), incredibly absurdres, best quality,concept art"
       negative: "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, "
       param: "Steps: 30, Sampler: Euler, CFG scale: 11.5, Seed: 1058629707, Size: 512x768, Variation seed: 1692844643, Variation seed strength: 0.27, Seed resize from: 1088x512"
 Background:
   '':
     simple background:
       value: simple background
     sunburst background:
       value: sunburst background
   Nature:
     Space:
       value: "space background, space,"
     Startrails:
       value: colorful startrails

Useful links for anime prompts:

sd-danbooru-tags or DeepDanbooru.

Using Prompt Gallery

  1. Slect tab "Prompt Gallery" on top navigation bar. You should see your dined prompt-sets in prompt-gallery.

  2. Select the avatar (model for demo)

  3. Select multiple prompt-sets

  4. Click "send WebUI"

2-1

  1. In a few minutes, Images geneated with teh selected prompt-sets will be downloaded in your browser

2-2

  1. The preview picture is missing. To add preview picture for each prompt-set, please refer to the next section.

Populate previews and QC

  1. For newly installed exteantion, there will be no preview pictures for each prompt-set.

3-1

  1. Goto tab "txt2img" in webui and Select "Prompt Gallery" in "scripts"

3-2

  1. Upload the avatar yaml library mentioned in section "Build Avatar library".

3-3

  1. Add default prompts or default negative (optional), default prompts are additional prompts that applied for each prompt-set preview picture generation

  2. Select "skip exists" if you wish to skip generating preview if preview picture exists for a prompt-set

3-4

  1. Wait for stable-diffusion-webui generate previews automatically.

3-5

  1. Pick the best image for preview picture of each prompt-set.

3-6

  1. Reflesh the browser. You should see the preview pictures in Prompt Gallery.

3-7

  1. The preview pictures are stored in prompt-gallery-directory/assets/preview/. You could always inspect the pictures manually.

(back to top)

Cutomize default image generation parameters

Sometimes you need to defined the default values for the AI model parameters.

  1. Change the params at the top of webui-directory/extension/prompt-gallery-extension-name/paste_this_to_webui_scripts_folder/prompt_gallery.py
BATCH_SIZE = 4
N_ITER = 2
STEPS = 30
CFG_SCALE = 11.5
WIDTH = 512
HEIGHT = 768
SAMPLER_INDEX = 1
RESTORE_FACE = 'true'
TILING = 'false'
DO_NOT_SAVE_GRID = 'false'

Customized extension ip and port (optional)

If you are using customized ip for webui and the extension fail to automatically detected your customized ip. Please try:

  1. Search %extension-path%\assets\index.*.js, change "127.0.0.1" to your customized webui ip

  2. Search %extension-path%\scripts\prompt_gallery.py change

pg_ip = "%your_webui_ip%" if shared.cmd_opts.listen else 'localhost'
pg_port = %your_webui_port%--
  1. Change the ip address in webui-user.bat (Win) or webui-user.sh (Linux)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

(back to top)

Built With

  • Vue
  • JavaScript
  • Gradio
  • Pytorch
  • React

Talk with me

(back to top)

Acknowledgments

(back to top)