Spaces:
Runtime error
Runtime error
Comply PDPA
Browse files
app/admin/admin_functions.py
CHANGED
|
@@ -38,6 +38,8 @@ async def register_user(db, email: str, name: str, role: str, file: UploadFile =
|
|
| 38 |
# Process the image to extract the face
|
| 39 |
cropped_face = get_user_cropped_image_from_photo(file_path)
|
| 40 |
|
|
|
|
|
|
|
| 41 |
if cropped_face is not None:
|
| 42 |
|
| 43 |
# Here we can store the embeddings along with user details in ChromaDB
|
|
@@ -46,10 +48,10 @@ async def register_user(db, email: str, name: str, role: str, file: UploadFile =
|
|
| 46 |
return {"status": "User registered successfully", "image": cropped_face}
|
| 47 |
|
| 48 |
else:
|
| 49 |
-
|
| 50 |
return {"error": "No faces detected"}
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
|
| 55 |
|
|
|
|
| 38 |
# Process the image to extract the face
|
| 39 |
cropped_face = get_user_cropped_image_from_photo(file_path)
|
| 40 |
|
| 41 |
+
os.remove(file_path) # Remove the file after processing, PDPA.
|
| 42 |
+
|
| 43 |
if cropped_face is not None:
|
| 44 |
|
| 45 |
# Here we can store the embeddings along with user details in ChromaDB
|
|
|
|
| 48 |
return {"status": "User registered successfully", "image": cropped_face}
|
| 49 |
|
| 50 |
else:
|
| 51 |
+
|
| 52 |
return {"error": "No faces detected"}
|
| 53 |
|
| 54 |
+
|
| 55 |
|
| 56 |
|
| 57 |
|