Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: review suggestions.

thorwebdev4c0cd2e37b6c
diff --git a/examples/ai/image_search/README.md b/examples/ai/image_search/README.md
index 1c8e9391b54..9169427c1f4 100644
--- a/examples/ai/image_search/README.md
+++ b/examples/ai/image_search/README.md
@@ -1,5 +1,12 @@
# Image Search with Supabase Vector
+In this example we're implementing image search using the [OpenAI CLIP Model](https://github.com/openai/CLIP), which was trained on a variety of (image, text)-pairs.
+
+We're implementing two methods in the [`/image_search/main.py` file](/image_search/main.py):
+
+1. The `seed` method generates embeddings for the images in the `images` folder and upserts them into a collection in Supabase Vector.
+2. Thw `search` method generates an embedding from the search query and performs a vector similarity search query.
+
## Setup
- Install poetry: `pip install poetry`
@@ -17,7 +24,7 @@
### Perform a search
-- `poetry run start "bike in front of red brick wall"`
+- `poetry run search "bike in front of red brick wall"`
## Run on hosted Supabase project
diff --git a/examples/ai/image_search/image_search/main.py b/examples/ai/image_search/image_search/main.py
index 26be775aac5..37c0fe5150f 100644
--- a/examples/ai/image_search/image_search/main.py
+++ b/examples/ai/image_search/image_search/main.py
@@ -12,7 +12,7 @@ def seed():
# create vector store client
vx = vecs.create_client(DB_CONNECTION)
- # create a collection of vectors with 3 dimensions
+ # create a collection of vectors with 512 dimensions
images = vx.create_collection(name="image_vectors", dimension=512)
# Load CLIP model
@@ -28,9 +28,9 @@ def seed():
images.upsert(
vectors=[
(
- "one.jpg", # the vector's identifier
- img_emb1, # the vector. list or np.array
- {"type": "jpg"} # associated metadata
+ "one.jpg", # the vector's identifier
+ img_emb1, # the vector. list or np.array
+ {"type": "jpg"} # associated metadata
), (
"two.jpg",
img_emb2,
@@ -53,7 +53,7 @@ def seed():
print("Created index")
-def start(args=sys.argv):
+def search(args=sys.argv):
# create vector store client
vx = vecs.create_client(DB_CONNECTION)
images = vx.get_collection(name="image_vectors")
diff --git a/examples/ai/image_search/pyproject.toml b/examples/ai/image_search/pyproject.toml
index 1b373ea47f2..54c6b18df3c 100644
--- a/examples/ai/image_search/pyproject.toml
+++ b/examples/ai/image_search/pyproject.toml
@@ -13,8 +13,8 @@ vecs = "^0.2.4"
matplotlib = "^3.7.1"
[tool.poetry.scripts]
-start = "image_search.main:start"
seed = "image_search.main:seed"
+search = "image_search.main:search"
[build-system]
requires = ["poetry-core"]