A flexible UI script to help create and expand on prompts for generative AI art models, such as Stable Diffusion and MidJourney. Get inspired, and create.

526christian 526christian Last update: Dec 13, 2023

AI-Image-PromptGenerator

PromptGen is a flexible UI script to help create and expand on prompts for generative AI art models, such as Stable Diffusion and MidJourney. Get inspired, and create. Multi-platform, and completely independent.

Acquire the latest version by git cloning the repository, or download directly. For additional info and guides, see the wiki pages. Also see the changelog to see what updates have been made to help know when to re-acquire files.

Features

Keyword-based system with configurable templates

Peek 2023-01-28 05-09

Input bracketed names of lists in the phrase dictionary to get a random selection, and use the special keywords [listadj], [liststy], and [listqual] to get a list of random visual adjectives, styles, and image quality tokens. Fill in random phrases to add some flavor to your prompts, or come up with new ones entirely.

Want your own keywords and lists? It's super easy, barely an inconvenience.

Use the sliders to instantly change the amount of random phrases picked from [listadj], [liststy], and [listqual] for your needs and to adjust to how different models respond.

A variety of basic default templates are provided for inspiration, and to show off how the inputs work.

Automatic1111 and InvokeAI export support

Peek 2023-01-28 05-18 Selection_234

Get prompts generated in command-line format for Automatic1111 and InvokeAI to easily queue up lists of prompts to be generated with Stable Diffusion, and with logs to import from text file.

Custom prompt template saving

Peek 2023-01-28 05-30

Save whatever you type in the template box to conveniently access in the dropdown later, text and keywords and all.

Phrase blacklisting

Peek 2023-01-28 05-24

Don't want certain phrases in your outputs, but don't want to delete them completely? Add them to the blacklist, and they'll be automatically yoinked out without affecting the random selections (as long as you don't blacklist every single word in the lists!)

And more to come...

Some planned features include:

  • A completely new, sleeker, customizable UI
  • Settings / state saving
  • New, and more specific phrase lists and categories
  • Importing and conversion between UI Stable Diffusion implementations' prompt syntax
  • Realtime customizable list-keywords with sliders

Install & startup

Prerequisites

To run this script all you need is:

That's it. You'll also need a web browser, but presumably, you already have one if you're reading this. To install Python3 if you haven't already, pick a version for your OS, and run the provided installer.

With Python3 out-of-the-way, open up a terminal / command prompt window, and type pip install gradio Peek 2023-01-28 05-45

Running the script

And now you're ready to run the script whenever you please. All you'll have to do is access the script with a single command, python path/to/promptgen.py: Peek 2023-02-10 19-23

It's best to keep the script and its dependent files in a folder that you can access easily. That'll make it easier to cd to the directory, or simply just drag-and-drop the script into the CLI.

Image examples

Here are examples of images generated using prompts generated from the provided default templates, and with no negative prompts:

battered hiker in a wondrous cave, gloomy, mysterious, incredible, vector art, chiaroscuro, thick lines, wavy, volumetric lighting, studio quality, sharp focus, detailed

Model: Roboetic's Mix

angelic human woman with a glass, dystopian, breathtaking, stunning, amazing, slow motion, high contrast, portrait, clean lines, highres, 8k, detailed, realistic

Model: Roboetic's Mix

A fair elf hideout, warm, amazing, otherworldly, cyberpunk, slow motion, hard edge, precise lineart, tonemapping, trending on artstation, professional, hyperdetailed, sharp focus

Model: Dreamlike Diffusion

futuristic explorer walking on an abandoned planet, lush, post-apocalyptic, tonal colors, ink, portrait, realistic, UHD, trending on artstation, highres

Model: DreamShaper v3.3

glowing futuristic military spaceship flying in front of a celestial moon in outer space, quiet, cozy, pretty, stunning, anime, splatter paint style, linocut, vintage, professional, raytracing, studio quality, UHD

Model: Roboetic's Mix

floral rowboat in the Caribbean Sea, magnificent, ominous, breathtaking, terrifying, cyberpunk, digital painting, sun rays, color page, realistic, HQ, professional, raytracing

Model: Elldreth's Stolen Dreams

Contributors and credits

Many thanks to:

  • junglerally, for being instrumental in brainstorming new ideas and contributing new features, such as the groundwork for the UI that helped move this project along much faster.
  • javi22020, whose prompt generator was the base for the original iteration of this script. We wouldn't be here without that inspiration base.

Subscribe to our newsletter