Spaces:
Runtime error
Runtime error
File size: 539 Bytes
63e2f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from pydantic import BaseModel
from deepface import DeepFace
import cv2
import numpy as np
import tempfile
def face_match(img1,img2):
with tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as temp1, \
tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as temp2:
cv2.imwrite(temp1.name, img1)
cv2.imwrite(temp2.name, img2)
result = DeepFace.verify(img1_path=temp1.name, img2_path=temp2.name, enforce_detection=False)
return result["verified"]
|