mirror of
https://github.com/supabase/supabase.git
synced 2026-07-07 08:30:20 +08:00
build(deps): bump transformers in /examples/ai/image_search Bumps [transformers](https://github.com/huggingface/transformers) from 4.30.0 to 4.36.0. - [Release notes](https://github.com/huggingface/transformers/releases) - [Commits](https://github.com/huggingface/transformers/compare/v4.30.0...v4.36.0) --- updated-dependencies: - dependency-name: transformers dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Image Search with Supabase Vector
In this example we're implementing image search using the OpenAI CLIP Model, which was trained on a variety of (image, text)-pairs.
We're implementing two methods in the /image_search/main.py file:
- The
seedmethod generates embeddings for the images in theimagesfolder and upserts them into a collection in Supabase Vector. - The
searchmethod generates an embedding from the search query and performs a vector similarity search query.
Setup
- Install poetry:
pip install poetry - Activate the virtual environment:
poetry shell- (to leave the venv just run
exit)
- (to leave the venv just run
- Install app dependencies:
poetry install
Run locally
Generate the embeddings and seed the collection
supabase startpoetry run seed- Check the embeddings stored in the local Supabase Dashboard: http://localhost:54323/project/default/editor > schema: vecs
Perform a search
poetry run search "bike in front of red brick wall"
Run on hosted Supabase project
- Set
DB_CONNECTIONwith the connection string from your hosted Supabase Dashboard: https://supabase.com/dashboard/project/_/settings/database > Connection string > URI
Attributions
Models
clip-ViT-B-32 via Hugging Face
Images
Images from https://unsplash.com/license via https://picsum.photos/