A super-simple utility for generating alt-text for images using the LVM "llava" via Ollama.
First, clone this repo to your local system:
git clone https://github.com/seanmtracey/alt-llava
To build, you will need Go >= v1.22.2. cd
into your cloned repo, and then run the following:
go mod tidy # Install dependencies
go build .
This will create a binary alt-llava
.
To run with minimal configuration, you will need to set at least 1 environment variable: IMAGE_URL
with a URL that links to an image. This image will be downloaded and stored at ./images
with a UUID and a file extension derived from the image's MIME type.
https://ollama.com must be running locally in order to accept and process the requests.
IMAGE_URL=<URL_TO_IMAGE> ./alt-llava
alt-llava
will then generate the alt-text for the image and log it to the CLI.
If you wish, you can write the output of alt-llava
to a text file by passing the --out
flag with the filepath you wish to write your results to.
./alt-llava --out="./output/results.txt"
OLLAMA_HOST
- The hostname where the Ollama server is running.OLLAMA_PORT
- The port the Ollama server is listening on.SILENT_OUTPUT
- Only output the alt-text tostdout
. Default:false
OLLAMA_MODEL
- The model that Ollama should run to generate the alt-text. Default:llava
OLLAMA_PROTOCOL
-http
orhttps
. Default:http
IMAGE_URL
- The image that should be downloaded, and have alt-text generated for.