
    .vh                     <    d dl Z d dlZd dlZd dlmZ  G d d      Zy)    N)DeepFacec                       e Zd Zd ZddZy)
fraudCheckc                     t        j                  |       }t        j                  |t        j                        }t        j                  |t
        j                        S )N)base64	b64decodenp
frombufferuint8cv2imdecodeIMREAD_COLOR)
b64_string
image_datanp_arrs      8/var/www/html/dev/engine/services/proctor/fraud_check.pydecode_base64_imagezfraudCheck.decode_base64_image   s=    %%j1
z2884||FC$4$455    c                    	 t         j                  |       }t         j                  |      }t        j                  ||d      }|d   }|d   }||k  }|||dS # t        $ r&}	t        d|	       t        |	      dd d dcY d }	~	S d }	~	ww xY w)NF)enforce_detectiondistance	threshold)verifiedr   r   u   ❌ Face match failed:)errorr   r   r   )r   r   r   verify	Exceptionprintstr)
id_image_b64
selfie_b64custom_thresholdid_img
selfie_imgresultr   r   r   es
             r   match_faceszfraudCheck.match_faces   s    	33LAF#77
CJ__VZ5QFj)H{+I#33H %$-   	*A.Q! !	 	s   AA 	B"B=BBN)g      ?)__name__
__module____qualname__r   r&    r   r   r   r      s    6
r   r   )r   r   numpyr	   deepfacer   r   r*   r   r   <module>r-      s     
   r   