Skip to content

Instantly share code, notes, and snippets.

View dontpaniclabsgists's full-sized avatar

Don't Panic Labs dontpaniclabsgists

View GitHub Profile
def search_faces(self, request: SearchFacesRequest) -> SearchFacesResponse:
all_results = []
for query_face in request.query_faces:
for model_name in query_face.model_names:
collection_name = f"face_embeddings_{model_name.lower()}"
# Perform vector similarity search
search_results = self._client.search(
collection_name=collection_name,
def store_faces(self, request: StoreFacesRequest) -> StoreFacesResponse:
stored_count = 0
face_ids = []
for image_faces_data in request.image_faces_data:
for face_data in image_faces_data.faces:
if face_data.embeddings and face_data.model_names:
for model_name in face_data.model_names:
face_record = FaceRecord(
face_id=f"{uuid.uuid4()}",
# This worked almost immediately
def _call_analyze_api(self, image_data: bytes) -> Dict[str, Any]:
headers = {
'Ocp-Apim-Subscription-Key': AZURE_VISION_API_KEY,
'Content-Type': 'application/octet-stream'
}
params = {
'features': 'tags,objects,faces,brands,landmarks,celebrities,categories,description,adult,color,imageType',
'model-version': 'latest'
# This approach never worked despite multiple attempts
from azure.ai.vision.imageanalysis import ImageAnalysisClient
from azure.core.credentials import AzureKeyCredential
client = ImageAnalysisClient(
endpoint=AZURE_VISION_ENDPOINT,
credential=AzureKeyCredential(AZURE_VISION_API_KEY)
)
# Qdrant collection setup for different embedding models
model_sizes = {
"VGG-Face": 4096,
"Facenet": 128,
"ArcFace": 512
}
def _ensure_collections_exist(self):
for model_name, vector_size in model_sizes.items():
collection_name = f"face_embeddings_{model_name.lower()}"
---
title: Service Architecture Guidelines
description: Strict Serivice Oriented Architecture
globs:
alwaysApply: true
---
# Service-Oriented Architecture (SOA) Guidelines
This project follows a strict Service-Oriented Architecture pattern. All services must adhere to these principles:
# Example of our service architecture
class FaceDetectionService:
def detect_faces(self, request: FaceDetectionRequest) -> FaceDetectionResponse:
# Implementation using DeepFace or Azure Face API
pass
class ArchiveService:
def store_faces(self, request: StoreFacesRequest) -> StoreFacesResponse:
# Store face embeddings in Qdrant vector database
pass
$("#order-details tr").on('click', function(evt) {/*do something*/});
$("#order-details").on('click', ‘tr’, function(evt) {/*do something*/});
$("#order-details").on('click', ‘tr’, function(evt) {/*do something*/});