Generate alt-text for images from a local or remote Ollama server running LLM vision models.
Project description
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.
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.
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 gen_alt_text-0.3.tar.gz.
File metadata
- Download URL: gen_alt_text-0.3.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
861a4fd51783c2d1468f09e0045fabe778330d73d02a683ef4cefdd3529db9c3
|
|
| MD5 |
71c9e04d130fa96ff4ed9cfb95fee676
|
|
| BLAKE2b-256 |
14aec74620705d7603db3a6ec967f75156ab122825b406b4acd5c40570e0f827
|
File details
Details for the file gen_alt_text-0.3-py3-none-any.whl.
File metadata
- Download URL: gen_alt_text-0.3-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38b07964f38e3d63f36509685180ba062baf459e3253752ea07addce5914fd30
|
|
| MD5 |
aa9bf745a1cc14ee05f2d4ef3afe9ff0
|
|
| BLAKE2b-256 |
a8e169a423a82f695bd3c5615475105bb270299e0d22a8f745ccfb04d279475a
|