Skip to main content

coldet

Colour detection inference — Python client and terminal CLI.

Point it at an image. Get a colour back. That's the core of it.

import coldet

coldet.token("your-api-key")                        # save once
result = coldet.request("product-photo.jpg", "coldet-v1-mini")

print(result["predicted"])    # → "beige"
print(result["confidence"])   # → 0.2778

Installation

pip install coldet

Add [video] to enable MP4 frame-by-frame analysis:

pip install "coldet[video]"

Requires Python ≥ 3.9.


Quick start

1. Save your API token

You only need to do this once. The token is written to ~/.config/coldet/token.

import coldet
coldet.token("your-api-key")

Or set the environment variable instead:

export COLDET_API_TOKEN="your-api-key"

2. Run inference

result = coldet.request("shirt.jpg", "coldet-v1-mini")

3. Read the result

print(result["predicted"])          # top colour name
print(result["confidence"])         # float 0–1
print(result["probabilities"])      # dict of all classes → probabilities
print(result["credits_left"])       # remaining API credits

API reference

coldet.token(value=None)

Get or set the saved API token.

Parameter Type Description
value str | None When given, writes the token to disk and returns it. When omitted, returns the saved token (or None).

Returns str | None

coldet.token("sk-abc123")   # save
tok = coldet.token()         # read back → "sk-abc123"

coldet.request(image_path, model, *, api_token=None)

Run colour-detection inference on a local image.

Parameter Type Default Description
image_path str required Local file path or public URL.
model str "coldet-v1-mini" Model name — no extension needed.
api_token str | None None Override the saved token for this call only.

Returns dict with the following keys:

Key Type Description
predicted str Top predicted colour name.
confidence float Probability of the top prediction (0–1).
probabilities dict[str, float] Full distribution over all colour classes.
credits_left int API credits remaining on your account.
user str Username associated with the token.
model str Model that produced the result.

Raises coldet.ColdetError if the token is missing, the file cannot be read, or the API returns an error.


coldet.ColdetError

Exception raised by coldet.request() on any API or configuration failure.

try:
    result = coldet.request("photo.jpg")
except coldet.ColdetError as e:
    print(f"something went wrong: {e}")

Available models

Model Description
coldet-v1-mini Fast, lightweight model. 58 colour classes. Recommended for most use cases.

More models will be added as they are released.


CLI

Installing the package registers a coldet command:

coldet

The terminal interface is interactive:

  • Drop in an image path (Tab-completion available) to run inference and see the full colour distribution.
  • Type // to open the command menu:
    • /model — switch the active model
    • /token — save or rotate your API token
    • /whoami — inspect your current token and model
    • /quit — exit

MP4 files are processed frame-by-frame when opencv-python is installed.


Configuration

Method Details
coldet.token("key") Saves to ~/.config/coldet/token
COLDET_API_TOKEN env var Read at runtime if no file is present
COLDET_CONFIG_DIR env var Override the config directory

Importing as a package

coldet is a regular importable package — the CLI is just one entry point.

# Batch-process a folder
from pathlib import Path
import coldet

coldet.token("your-api-key")

images = Path("product-photos").glob("*.jpg")
for img in images:
    result = coldet.request(str(img))
    print(img.name, "→", result["predicted"], f"({result['confidence']:.1%})")

License

MIT

Metadata

Release files for coldet 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coldet 1.0.1
File Size Uploaded Provenance Actions
coldet-1.0.1.tar.gz 9.6 kB Without provenance Details for coldet-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for coldet 1.0.1
File Interpreter ABI Platform Actions
coldet-1.0.1-py3-none-any.whl Python 3 none any Details for coldet-1.0.1-py3-none-any.whl

Total release size: 20.5 kB

Release files / coldet-1.0.1.tar.gz

Download URL coldet-1.0.1.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f9af3b8ab1fa1460a2fefdf79a7764d01a1eaab473afdc90f186f1a46e1ac845
BLAKE2b-256 checksum
How to use checksums
9bb265bf3245d2971808b6e1dfd53c20914e8cff7b7e7f64965b88886336a5cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / coldet-1.0.1-py3-none-any.whl

Download URL coldet-1.0.1-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03b2e8a605b5b93fd00dbd482e07d09b498f197856441f5261f56ebaa6fb079f
BLAKE2b-256 checksum
How to use checksums
773b4469cc7970ad22335113b9367d0593db7917989c485027fe0a80fb7ba749
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for coldet 1.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page