A simple prompt generator API for Stable Diffusion / Midjourney / Dall-e based in Python.
The API takes an initial prompt of a few words, and generates an extended and detailed prompt.
Based on the implementation of the FredZhang7/distilgpt2-stable-diffusion-v2 model.
Contributions are welcome :)
Initial prompt
cat with sunglasses
Results of this prompt using Stable Diffusion v1.5
Generated prompt using this API
cat with sunglasses, in the style of studio ghibli painting. cinematic lighting from right side on image and sharp focus by jean - baptiste monge! octane render redshift unreal engine 5 lumen global illumination ray tracing hdr arstation pixar disney tone mapping shiny reflectionsordan grimmer 4 k 8 lois van baal enki bilan ilya
Results of this prompt using Stable Diffusion v1.5
The API currently provides a POST endpoint to generate the prompt, configured to run at /generate
pip install --upgrade torch transformers flask flask_restful flask_limiter
git clone https://github.com/jordip/prompt-generator-api.git
python3 main.py
curl http://127.0.0.1:5000/generate -H "Content-Type: application/json" -d '{"prompt":"cat with sunglasses"}' -X POST
blacklist.txt contains a list of terms to be replaced from the returned prompt. One term per line.
The API is configured to limit the amount of requests received per minute by a single user.