Skip to main content

gen-alt-text

  • This program generates alt-text for images using a local or remote Ollama server.
  • The Ollama server must be running before using this program.
  • See Ollama for installation and usage instructions.

Installation

pipx install gen-alt-text

Usage

gen-alt-text -m "llama3.2-vision:11b" ~/pictures/autumn-scenery.jpg
gen-alt-text ~/pictures/winter-scenery.jpg
gen-alt-text -m "llama3.2-vision:90b" ~/pictures/coffee.jpg

If the model supplied to the -m argument is not currently available on the Ollama server, gen-alt-text will pull it for you, and then you must re-run the program to use it.

Remote Ollama server

For remote Ollama servers, the server must be configured to listen on 0.0.0.0:11434 and port 11434 must be open in the firewall. Edit the systemd service file as follows:

sudo systemctl edit ollama.service

Add the following:

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"

Save the file and exit the editor.

I personally use a remote server that is not public-facing and is only accessible through my Tailscale network, or tailnet.

On the local machine that you're running this program on, set the OLLAMA_HOST environment variable to use a remote Ollama server.

export OLLAMA_HOST="http://ollama.tailnet.ts.net:11434"
gen-alt-text ~/pictures/goth_hacker_girl.jpg

Local Ollama server

The ollama.service systemd unit should already be configured to listen on localhost:11434 by default, so no additional configuration is necessary.

Example

I fed the image below to the llama3.2-vision:11b model.

fall-leaves-cover-photo.jpg

This was the alt-text it generated:

The image depicts a serene autumnal scene, with a cup of coffee placed on a stone surface amidst fallen leaves. In the foreground, a dark brown ceramic mug filled with black coffee sits atop a large, flat gray stone. The mug's handle is positioned towards the right side of the image. Surrounding the mug are vibrant red and orange fallen leaves, which have accumulated in a pile to the left of the stone. Some of these leaves appear to be scattered across the surface of the stone as well. The background of the image features more fallen leaves, creating a sense of depth and atmosphere. The overall mood of the scene is one of tranquility and coziness, evoking feelings of relaxation and comfort.

Metadata

Release files for gen-alt-text 0.3

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

Source distribution (sdist)

Source distribution for gen-alt-text 0.3
File Size Uploaded Provenance Actions
gen_alt_text-0.3.tar.gz 15.3 kB Without provenance Details for gen_alt_text-0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gen-alt-text 0.3
File Interpreter ABI Platform Actions
gen_alt_text-0.3-py3-none-any.whl Python 3 none any Details for gen_alt_text-0.3-py3-none-any.whl

Total release size: 31.3 kB

Release files / gen_alt_text-0.3.tar.gz

Download URL gen_alt_text-0.3.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
861a4fd51783c2d1468f09e0045fabe778330d73d02a683ef4cefdd3529db9c3
BLAKE2b-256 checksum
How to use checksums
14aec74620705d7603db3a6ec967f75156ab122825b406b4acd5c40570e0f827
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Release files / gen_alt_text-0.3-py3-none-any.whl

Download URL gen_alt_text-0.3-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38b07964f38e3d63f36509685180ba062baf459e3253752ea07addce5914fd30
BLAKE2b-256 checksum
How to use checksums
a8e169a423a82f695bd3c5615475105bb270299e0d22a8f745ccfb04d279475a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Security for gen-alt-text 0.3

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.

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files No provenance

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