Update app.py
Browse files
app.py
CHANGED
@@ -2,20 +2,26 @@ import face_checker as fc
|
|
2 |
import face_extract as fe
|
3 |
import gradio as gr
|
4 |
from PIL import Image
|
|
|
|
|
|
|
5 |
def fun(id_img_path,selfie_img_path):
|
|
|
6 |
img = Image.fromarray(id_img_path,'RGB')
|
7 |
img.save("id.jpg")
|
8 |
img2 = Image.fromarray(selfie_img_path,'RGB')
|
9 |
img2.save("selfie.jpg")
|
10 |
-
|
11 |
-
|
|
|
|
|
12 |
return str(res)
|
13 |
|
14 |
interface = gr.Interface(fun,inputs=[gr.Image(),gr.Image()],outputs='text')
|
15 |
# Will return True or false
|
16 |
|
17 |
|
18 |
-
interface.launch()
|
19 |
|
20 |
# id_img_path ="test.jpg" #give image path
|
21 |
# selfie_img_path = "142142_faces.jpg" #give path of curret face
|
|
|
2 |
import face_extract as fe
|
3 |
import gradio as gr
|
4 |
from PIL import Image
|
5 |
+
import easyocr
|
6 |
+
import ocr as o
|
7 |
+
reader = easyocr.Reader(['ch_sim','en'])
|
8 |
def fun(id_img_path,selfie_img_path):
|
9 |
+
res = False
|
10 |
img = Image.fromarray(id_img_path,'RGB')
|
11 |
img.save("id.jpg")
|
12 |
img2 = Image.fromarray(selfie_img_path,'RGB')
|
13 |
img2.save("selfie.jpg")
|
14 |
+
r = o.ocr("id.jpg",reader)
|
15 |
+
if r:
|
16 |
+
extracted_facename = fe.extract("id.jpg")
|
17 |
+
res = fc.check(extracted_facename,'selfie.jpg')
|
18 |
return str(res)
|
19 |
|
20 |
interface = gr.Interface(fun,inputs=[gr.Image(),gr.Image()],outputs='text')
|
21 |
# Will return True or false
|
22 |
|
23 |
|
24 |
+
interface.launch(share= True)
|
25 |
|
26 |
# id_img_path ="test.jpg" #give image path
|
27 |
# selfie_img_path = "142142_faces.jpg" #give path of curret face
|