Generate embeddings for images and text using CLIP with LLM
Project description
llm-clip
LLM plugin for embedding images and text using CLIP
Installation
Install this plugin in the same environment as LLM.
llm install llm-clip
Usage
Once you have installed an embedding model you can use it to embed text like this:
llm embed -m clip -c 'Hello world'
Or an image like this:
llm embed -m clip --binary -i IMG_4801.jpeg
Embeddings are more useful if you store them in a database - see the LLM documentation for details.
To embed every photograph in a folder and save them in a collection called "photos":
llm embed-multi photos -m clip --binary --files photos/ '*.jpg'
You can then search for photos of specific things like this:
llm similar photos -c 'bunny'
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-clip
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
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
File details
Details for the file llm-clip-0.1.tar.gz
.
File metadata
- Download URL: llm-clip-0.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcd7efe71a55170b530c30dbf4088d8af80c72562dc85dbd6ec48324525dbb7e |
|
MD5 | 08fe3eba9fb2742adae33640264f0277 |
|
BLAKE2b-256 | 7beff16404d79cff379f3098ce95cbe205929a01dfa6b5946331fdfe7b0e4f53 |
File details
Details for the file llm_clip-0.1-py3-none-any.whl
.
File metadata
- Download URL: llm_clip-0.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31bca3c6dd3e4df192a805ff7d44eb788ccf6d4f1cb8b078f28adc8a2d547e1d |
|
MD5 | 1f4ccc53fcf89b56982dd3d022a99618 |
|
BLAKE2b-256 | 05512a9b1b753c8f127275ccbbc8ae3cc3bfd6af9882566542273583ad885369 |