Perfect your image generation prompt with a visual LLM.
Project description
perfect-prompt
Perfect your image generation prompt with a visual LLM.
Works best to improve adherence to complex prompts.
Installation
Install this tool using pip or pipx:
pip install perfect-prompt
Optional: to run image generation locally, you will also need to install ComfyUI with FLUX.1-dev.
Usage
Basic usage:
perfect-prompt "a romantic couple walking along the beach holding hands and looking lovingly at each other, wearing beachwear, sunset, detailed faces, front view, soft focus, golden hour lighting, warm natural lighting." -o images -n 3 --comfy-output-dir="C:\ComfyUI_windows_portable\ComfyUI\output"
This will generate 3 images attempting to adhere to this prompt within ./images.
By default, perfect-prompt uses local models. You can configure this behavior with flags. For example, here is a version of the above prompt that uses the same models via API:
perfect-prompt "a romantic couple walking along the beach holding hands and looking lovingly at each other, wearing beachwear, sunset, detailed faces, front view, soft focus, golden hour lighting, warm natural lighting." -o images -n 3 --refine-model=pixtral-12b --gen-model=flux-dev
Since this uses APIs, you'll need keys set in your environment:
LLM_MISTRAL_KEY=<your key from https://console.mistral.ai/>
BFL_API_KEY=<your key from https://docs.bfl.ml/>
Many models are available for --refine-model via Simon Willison’s llm package, for example:
gpt-4o (uses OPENAI_API_KEY)
gpt-4o-mini (uses OPENAI_API_KEY)
pixtral-12b (uses LLM_MISTRAL_KEY)
pixtral-large (uses LLM_MISTRAL_KEY)
gemini-1.5-pro-latest (uses LLM_GEMINI_KEY)
gemini-1.5-flash-latest (uses LLM_GEMINI_KEY)
For help, run:
perfect-prompt --help
You can also use:
python -m perfect_prompt --help
Development
To contribute to this tool, use uv. The following command will establish the venv and run tests:
uv run pytest
To run perfect-prompt locally, use:
uv run perfect-prompt
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file perfect_prompt-0.1.0.tar.gz.
File metadata
- Download URL: perfect_prompt-0.1.0.tar.gz
- Upload date:
- Size: 71.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dfff7abd171192c4dd396ec841c76b8a0a93a347d1b6d15d4b258c1395fe7b4
|
|
| MD5 |
c97633c3fdd2c5a2956118521d345f3c
|
|
| BLAKE2b-256 |
10253d778566647090fe4c46404fb9cbba41b367354b39574cc6821f2b34abf7
|
Provenance
The following attestation bundles were made for perfect_prompt-0.1.0.tar.gz:
Publisher:
publish.yml on wolfmanstout/perfect-prompt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
perfect_prompt-0.1.0.tar.gz -
Subject digest:
5dfff7abd171192c4dd396ec841c76b8a0a93a347d1b6d15d4b258c1395fe7b4 - Sigstore transparency entry: 152747061
- Sigstore integration time:
-
Permalink:
wolfmanstout/perfect-prompt@e51acbf7c813f9d4460c9b8948c7c1c5a5c8ae32 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/wolfmanstout
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e51acbf7c813f9d4460c9b8948c7c1c5a5c8ae32 -
Trigger Event:
release
-
Statement type:
File details
Details for the file perfect_prompt-0.1.0-py3-none-any.whl.
File metadata
- Download URL: perfect_prompt-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dabb78fe1516bfa9a2e8baa11bf1d755ca405ba64f35f41928d035f83fdee40e
|
|
| MD5 |
3ba79ef04594684bbc5f7cf6a47b3a15
|
|
| BLAKE2b-256 |
9ed4e46648aba532e7c5a2ff1f5d3b9ec9ab13f5c83c7ef0ee0a9f38b0b6499e
|
Provenance
The following attestation bundles were made for perfect_prompt-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on wolfmanstout/perfect-prompt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
perfect_prompt-0.1.0-py3-none-any.whl -
Subject digest:
dabb78fe1516bfa9a2e8baa11bf1d755ca405ba64f35f41928d035f83fdee40e - Sigstore transparency entry: 152747062
- Sigstore integration time:
-
Permalink:
wolfmanstout/perfect-prompt@e51acbf7c813f9d4460c9b8948c7c1c5a5c8ae32 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/wolfmanstout
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e51acbf7c813f9d4460c9b8948c7c1c5a5c8ae32 -
Trigger Event:
release
-
Statement type: