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
Metadata
Release files for perfect-prompt 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| perfect_prompt-0.1.0.tar.gz | 71.9 kB | With provenance | Details for perfect_prompt-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| perfect_prompt-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for perfect_prompt-0.1.0-py3-none-any.whl |
Total release size: 85.0 kB
Release files / perfect_prompt-0.1.0.tar.gz
| Download URL | perfect_prompt-0.1.0.tar.gz |
|---|---|
| Size | 71.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5dfff7abd171192c4dd396ec841c76b8a0a93a347d1b6d15d4b258c1395fe7b4
|
|
BLAKE2b-256 checksum How to use checksums |
10253d778566647090fe4c46404fb9cbba41b367354b39574cc6821f2b34abf7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.
Transparency logRelease files / perfect_prompt-0.1.0-py3-none-any.whl
| Download URL | perfect_prompt-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dabb78fe1516bfa9a2e8baa11bf1d755ca405ba64f35f41928d035f83fdee40e
|
|
BLAKE2b-256 checksum How to use checksums |
9ed4e46648aba532e7c5a2ff1f5d3b9ec9ab13f5c83c7ef0ee0a9f38b0b6499e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.
Transparency logSecurity for perfect-prompt 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for perfect_prompt-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.