Spaces:
Build error
Build error
Create biometric_auth.py
Browse files- biometric_auth.py +9 -0
biometric_auth.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# New biometric_auth.py
|
| 2 |
+
import cv2
|
| 3 |
+
import face_recognition
|
| 4 |
+
|
| 5 |
+
class BiometricAuth:
|
| 6 |
+
def verify_face(self, image_path, stored_encoding):
|
| 7 |
+
current_image = face_recognition.load_image_file(image_path)
|
| 8 |
+
current_encoding = face_recognition.face_encodings(current_image)[0]
|
| 9 |
+
return face_recognition.compare_faces([stored_encoding], current_encoding)[0]
|