id_verfiy / app.py
Namit2111's picture
Update app.py
85f4f20
raw
history blame
771 Bytes
import face_checker as fc
import face_extract as fe
import gradio as gr
from PIL import Image
import easyocr
import ocr as o
reader = easyocr.Reader(['ch_sim','en'])
def fun(id_img_path,selfie_img_path):
res = False
img = Image.fromarray(id_img_path,'RGB')
img.save("id.jpg")
img2 = Image.fromarray(selfie_img_path,'RGB')
img2.save("selfie.jpg")
r = o.ocr("id.jpg",reader)
if r:
extracted_facename = fe.extract("id.jpg")
res = fc.check(extracted_facename,'selfie.jpg')
return str(res)
interface = gr.Interface(fun,inputs=[gr.Image(),gr.Image()],outputs='text')
# Will return True or false
interface.launch(share= True)
# id_img_path ="test.jpg" #give image path
# selfie_img_path = "142142_faces.jpg" #give path of curret face