A CLI to generate captions for images using the GiT model from MSFT
Install imgcap
in your system using:
pip install imgcap
The model size is of 707MB and once initially downloaded, it will be stored in the ~/.cache/huggingface/hub/
.
Run the CLI tool as follows
imgcap [OPTIONS] PATHS..
--output [pretty|json]
: Specify the output format (default: pretty).--max-tokens INTEGER
: Maximum number of tokens in the generated caption (default: 50).--recursive
: Recursively process directories to find images.--threads INTEGER
: Number of threads to use for processing (default: 1)
- Generate captions for a single image:
imgcap ./path/to/image.jpg --output pretty
- Generate captions for all images in a directory:
imgcap ./path/to/directory --recursive --output json
- Use multiple threads for faster processing:
imgcap ./images --threads 4