Skip to main content

Perfect your image generation prompt with a visual LLM.

Project description

perfect-prompt

PyPI Changelog Tests License

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

perfect_prompt-0.1.0.tar.gz (71.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

perfect_prompt-0.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

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

Hashes for perfect_prompt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5dfff7abd171192c4dd396ec841c76b8a0a93a347d1b6d15d4b258c1395fe7b4
MD5 c97633c3fdd2c5a2956118521d345f3c
BLAKE2b-256 10253d778566647090fe4c46404fb9cbba41b367354b39574cc6821f2b34abf7

See more details on using hashes here.

Provenance

The following attestation bundles were made for perfect_prompt-0.1.0.tar.gz:

Publisher: publish.yml on wolfmanstout/perfect-prompt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for perfect_prompt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dabb78fe1516bfa9a2e8baa11bf1d755ca405ba64f35f41928d035f83fdee40e
MD5 3ba79ef04594684bbc5f7cf6a47b3a15
BLAKE2b-256 9ed4e46648aba532e7c5a2ff1f5d3b9ec9ab13f5c83c7ef0ee0a9f38b0b6499e

See more details on using hashes here.

Provenance

The following attestation bundles were made for perfect_prompt-0.1.0-py3-none-any.whl:

Publisher: publish.yml on wolfmanstout/perfect-prompt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page