The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: missed PR review suggestions.
thorwebdev356f6d87f49f
diff --git a/apps/docs/pages/guides/ai/examples/image-search-python.mdx b/apps/docs/pages/guides/ai/examples/image-search-python.mdxindex fcfc4980c1d..1dc397cbccd 100644--- a/apps/docs/pages/guides/ai/examples/image-search-python.mdx+++ b/apps/docs/pages/guides/ai/examples/image-search-python.mdx@@ -13,19 +13,19 @@ You can use the CLIP model for:- Text-to-Image / Image-To-Text / Image-to-Image / Text-to-Text Search- You can fine-tune it on your own image&text data with the regular SentenceTransformers training code.-[SentenceTransformers](https://www.sbert.net/examples/applications/image-search/README.html) provides models that allow to embed images and text into the same vector space. This allows to find similar images as well as to implement image search.+[SentenceTransformers](https://www.sbert.net/examples/applications/image-search/README.html) provides models that allow you to embed images and text into the same vector space. You can use this to find similar images as well as to implement image search.-You can find the full application code as a Python Poetry project on [GitHub](https://github.com/supabase/supabase/tree/master/examples/ai/image_search#image-search-with-supabase-vector)+You can find the full application code as a Python Poetry project on [GitHub](https://github.com/supabase/supabase/tree/master/examples/ai/image_search#image-search-with-supabase-vector).## Create a new Python Project with Poetry-[Poetry](https://python-poetry.org/) provides packaging and dependency management for Python. If you haven't already, install poetry via pip+[Poetry](https://python-poetry.org/) provides packaging and dependency management for Python. If you haven't already, install poetry via pip:```shellpip install poetry```-Then initialize a new project+Then initialize a new project:```shellpoetry new image-search@@ -39,7 +39,7 @@ If you haven't already, [install the Supabase CLI](/docs/guides/cli), then initisupabase init```-Next, start your local Supabase stack+Next, start your local Supabase stack:```shellsupabase start@@ -52,7 +52,7 @@ This will start up the Supabase stack locally and print out a bunch of environtmWe will need to add the following dependencies to our project:- [`vecs`](https://github.com/supabase/vecs#vecs): Supabase Vector Python Client.-- [`sentence-transformers`](https://huggingface.co/sentence-transformers/clip-ViT-B-32): a wrapper for the OpenAI CLIP Model+- [`sentence-transformers`](https://huggingface.co/sentence-transformers/clip-ViT-B-32): a framework for sentence, text and image embeddings (used with OpenAI CLIP model)- [`matplotlib`](https://matplotlib.org/): for displaying our image result```shell@@ -61,7 +61,7 @@ poetry add vecs sentence-transformers matplotlib## Import the necessary dependencies-At the top of your main python script, import the needed dependencies and store your `DB URL` from above in a variable:+At the top of your main python script, import the dependencies and store your `DB URL` from above in a variable:```pythonimport sys@@ -76,7 +76,7 @@ DB_CONNECTION = "postgresql://postgres:postgres@localhost:54322/postgres"## Create embeddings for your images-In the root of your project, create a new folder called `images` and add some images. You con use the images from the example project on [GitHub](https://github.com/supabase/supabase/tree/master/examples/ai/image_search/images) or you can find license free images on [unsplash](https://unsplash.com).+In the root of your project, create a new folder called `images` and add some images. You can use the images from the example project on [GitHub](https://github.com/supabase/supabase/tree/master/examples/ai/image_search/images) or you can find license free images on [unsplash](https://unsplash.com).Next, create a `seed` method, which will create a new Supabase Vector Collection, generate embeddings for your images, and upsert the embeddings into your database:@@ -126,22 +126,22 @@ def seed():print("Created index")```-Add his method as a script in your `pyproject.toml` file:+Add this method as a script in your `pyproject.toml` file:```toml[tool.poetry.scripts]-start = "image_search.main:start"seed = "image_search.main:seed"+search = "image_search.main:search"```-Afer activating the virtual environtment with `poetry shell` you can now run your seed script via `poetry run seed`. You can inspect the generated embeddings in your local Database by visiting the local Supabase Dasbboard at [localhost:54323](http://localhost:54323/project/default/editor), selecting the `vecs` schema, and the `image_vectors` database.+After activating the virtual environtment with `poetry shell` you can now run your seed script via `poetry run seed`. You can inspect the generated embeddings in your local database by visiting the local Supabase dashboard at [localhost:54323](http://localhost:54323/project/default/editor), selecting the `vecs` schema, and the `image_vectors` database.## Perform an Image Search from a Text QueryWith Supabase Vector we can easily query our embeddings. We can use either an image as search input or alternative we can generate an embedding from a string input and use that as the query input:```python-def start():+def search():# create vector store clientvx = vecs.create_client(DB_CONNECTION)images = vx.get_collection(name="image_vectors")@@ -166,9 +166,9 @@ def start():plt.show()```-By limiting the query to one result, we can show the most relevant image result to the user. Finally we use `matplotlib` to show the image result to the user.+By limiting the query to one result, we can show the most relevant image to the user. Finally we use `matplotlib` to show the image result to the user.-That's it, go ahead and test it out by running `poetry run start` and you will be presented with an image of a "bike in front of a red brick wall".+That's it, go ahead and test it out by running `poetry run search` and you will be presented with an image of a "bike in front of a red brick wall".## Conclusion