Initial implementation of pgvector and Oracle 26ai vector search demo

Three FastAPI backends comparing PostgreSQL/pgvector and Oracle 26ai for
semantic image search using CLIP embeddings: Python-side embedding for both
databases, plus Oracle in-database embedding via VECTOR_EMBEDDING(CLIP_TXT).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 11:33:16 +02:00
commit 66f7db40b0
15 changed files with 1347 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
from sentence_transformers import SentenceTransformer
from PIL import Image
_model = None
def _get_model():
global _model
if _model is None:
_model = SentenceTransformer("clip-ViT-B-32")
return _model
def embed_image(path: str) -> list[float]:
img = Image.open(path).convert("RGB")
return _get_model().encode(img).tolist()
def embed_text(text: str) -> list[float]:
return _get_model().encode(text).tolist()