llm-clip


Namellm-clip JSON
Version 0.1 PyPI version JSON
download
home_page
SummaryGenerate embeddings for images and text using CLIP with LLM
upload_time2023-09-12 19:32:16
maintainer
docs_urlNone
authorSimon Willison
requires_python
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # llm-clip

[![PyPI](https://img.shields.io/pypi/v/llm-clip.svg)](https://pypi.org/project/llm-clip/)
[![Changelog](https://img.shields.io/github/v/release/simonw/llm-clip?include_prereleases&label=changelog)](https://github.com/simonw/llm-clip/releases)
[![Tests](https://github.com/simonw/llm-clip/workflows/Test/badge.svg)](https://github.com/simonw/llm-clip/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-clip/blob/main/LICENSE)

[LLM](https://llm.datasette.io/) plugin for embedding images and text using [CLIP](https://openai.com/research/clip)

## Installation

Install this plugin in the same environment as LLM.
```bash
llm install llm-clip
```

## Usage

Once you have installed an embedding model you can use it to embed text like this:

```bash
llm embed -m clip -c 'Hello world'
```
Or an image like this:
```bash
llm embed -m clip --binary -i IMG_4801.jpeg
```

Embeddings are more useful if you store them in a database - see [the LLM documentation](https://llm.datasette.io/en/stable/embeddings/cli.html#storing-embeddings-in-sqlite) for details.

To embed every photograph in a folder and save them in a collection called "photos":

```bash
llm embed-multi photos -m clip --binary --files photos/ '*.jpg'
```
You can then search for photos of specific things like this:
```bash
llm similar photos -c 'bunny'
```

## Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd llm-clip
python3 -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
pip install -e '.[test]'
```
To run the tests:
```bash
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "llm-clip",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Simon Willison",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/7b/ef/f16404d79cff379f3098ce95cbe205929a01dfa6b5946331fdfe7b0e4f53/llm-clip-0.1.tar.gz",
    "platform": null,
    "description": "# llm-clip\n\n[![PyPI](https://img.shields.io/pypi/v/llm-clip.svg)](https://pypi.org/project/llm-clip/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/llm-clip?include_prereleases&label=changelog)](https://github.com/simonw/llm-clip/releases)\n[![Tests](https://github.com/simonw/llm-clip/workflows/Test/badge.svg)](https://github.com/simonw/llm-clip/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-clip/blob/main/LICENSE)\n\n[LLM](https://llm.datasette.io/) plugin for embedding images and text using [CLIP](https://openai.com/research/clip)\n\n## Installation\n\nInstall this plugin in the same environment as LLM.\n```bash\nllm install llm-clip\n```\n\n## Usage\n\nOnce you have installed an embedding model you can use it to embed text like this:\n\n```bash\nllm embed -m clip -c 'Hello world'\n```\nOr an image like this:\n```bash\nllm embed -m clip --binary -i IMG_4801.jpeg\n```\n\nEmbeddings are more useful if you store them in a database - see [the LLM documentation](https://llm.datasette.io/en/stable/embeddings/cli.html#storing-embeddings-in-sqlite) for details.\n\nTo embed every photograph in a folder and save them in a collection called \"photos\":\n\n```bash\nllm embed-multi photos -m clip --binary --files photos/ '*.jpg'\n```\nYou can then search for photos of specific things like this:\n```bash\nllm similar photos -c 'bunny'\n```\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd llm-clip\npython3 -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```bash\npip install -e '.[test]'\n```\nTo run the tests:\n```bash\npytest\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Generate embeddings for images and text using CLIP with LLM",
    "version": "0.1",
    "project_urls": {
        "CI": "https://github.com/simonw/llm-clip/actions",
        "Changelog": "https://github.com/simonw/llm-clip/releases",
        "Homepage": "https://github.com/simonw/llm-clip",
        "Issues": "https://github.com/simonw/llm-clip/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "05512a9b1b753c8f127275ccbbc8ae3cc3bfd6af9882566542273583ad885369",
                "md5": "1f4ccc53fcf89b56982dd3d022a99618",
                "sha256": "31bca3c6dd3e4df192a805ff7d44eb788ccf6d4f1cb8b078f28adc8a2d547e1d"
            },
            "downloads": -1,
            "filename": "llm_clip-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1f4ccc53fcf89b56982dd3d022a99618",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6881,
            "upload_time": "2023-09-12T19:32:14",
            "upload_time_iso_8601": "2023-09-12T19:32:14.857283Z",
            "url": "https://files.pythonhosted.org/packages/05/51/2a9b1b753c8f127275ccbbc8ae3cc3bfd6af9882566542273583ad885369/llm_clip-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7beff16404d79cff379f3098ce95cbe205929a01dfa6b5946331fdfe7b0e4f53",
                "md5": "08fe3eba9fb2742adae33640264f0277",
                "sha256": "fcd7efe71a55170b530c30dbf4088d8af80c72562dc85dbd6ec48324525dbb7e"
            },
            "downloads": -1,
            "filename": "llm-clip-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "08fe3eba9fb2742adae33640264f0277",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6608,
            "upload_time": "2023-09-12T19:32:16",
            "upload_time_iso_8601": "2023-09-12T19:32:16.339954Z",
            "url": "https://files.pythonhosted.org/packages/7b/ef/f16404d79cff379f3098ce95cbe205929a01dfa6b5946331fdfe7b0e4f53/llm-clip-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-12 19:32:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simonw",
    "github_project": "llm-clip",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llm-clip"
}
        
Elapsed time: 0.11968s