Last active
September 8, 2025 19:10
-
-
Save dontpaniclabsgists/3632494f15e3340c401a3d0e769892fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()}", | |
image_source=image_faces_data.image_source, | |
timestamp=datetime.now(), | |
embeddings=face_data.embeddings, | |
model_names=face_data.model_names, | |
face_detection_confidence=face_data.face_detection_confidence, | |
coordinates=face_data.coordinates | |
) | |
# Store in appropriate collection | |
collection_name = f"face_embeddings_{model_name.lower()}" | |
point = self._face_record_to_point(face_record, model_name) | |
self._client.upsert(collection_name=collection_name, points=[point]) | |
stored_count += 1 | |
face_ids.append(face_record.face_id) | |
return StoreFacesResponse(success=True, stored_count=stored_count, face_ids=face_ids) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment