GithubHelp home page GithubHelp logo

yozer / sd-dynamic-prompting Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adieyal/sd-dynamic-prompts

0.0 0.0 0.0 10 KB

A custom script for AUTOMATIC1111/stable-diffusion-webui to implement a tiny template language for random prompt generation

License: MIT License

Python 100.00%

sd-dynamic-prompting's Introduction

Dynamic Prompt templates

A custom script for AUTOMATIC1111/stable-diffusion-webui to implement a tiny template language for random prompt generation.

Using this script, the prompt:

A {house|apartment|lodge|cottage} in {summer|winter|autumn|spring} by {2$$artist1|artist2|artist3}

Will any of the following prompts:

  • A house in summer by artist1, artist2
  • A lodge in autumn by artist3, artist1
  • A cottage in winter by artist2, artist3
  • ...

This is especially useful if you are searching for interesting combinations of artists and styles.

You can also pick a random string from a file. Assuming you have the file seasons.txt in WILDCARD_DIR (see below), then:

__seasons__ is coming

Might generate the following:

  • Winter is coming
  • Spring is coming
  • ...

You can also use the same wildcard twice

I love __seasons__ better than __seasons__
  • I love Winter better than Summer
  • I love Spring better than Spring

Template syntax

Combinations

[2$$opt1|opt2|opt3]

This will randomly combine two of the options for every batch, separated with a comma. In this case, "opt1, opt2" or "opt2, opt3", or "opt1, opt3" or the same pairs in the reverse order.

The prefix 2$$ can use any number between 1 and the total number of options you defined. If you omit the size prefix, then 1 will be used

Wildcard files

Wildcard files are not provided by this script as lists exists in other repositories. A good place to start looking is here

Nesting

You can nest combinations inside wildcards. This means that you can create more advanced templates. For example:

{__seasons__|__timeofday__}

This will then either choose a season from seasons.txt or a time of day from timeofday.txt.

WILDCARD_DIR

The script looks for wildcard files in WILDCARD_DIR. This is defined in the main webui config.json under wildcard_dir. If wildcard_dir is missing, then wildcard files should be placed in scripts/wildcards/

sd-dynamic-prompting's People

Contributors

adieyal 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.