wasay commited on
Commit
3798e66
1 Parent(s): 8f23b65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -11,6 +11,7 @@ import pathlib
11
  from fastai.vision.all import *
12
  from fastai.imports import *
13
  from tensorflow.keras.models import model_from_json
 
14
 
15
  json_file = open('model.json', 'r')
16
  loaded_model_json = json_file.read()
@@ -76,11 +77,11 @@ def who_is_it(image):
76
  return ("Not in database")
77
 
78
  label = gr.outputs.Label()
79
- mtcnn = MTCNN(image_size=224)
80
  def recog(image):
81
- face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
82
- faces = face_cascade.detectMultiScale(image, scaleFactor=1.3, minNeighbors=5)
83
- for x,y,w,h in faces:
84
  img = image[y:y+h, x:x+w]
85
  if face is not None:
86
  identity=who_is_it(img)
 
11
  from fastai.vision.all import *
12
  from fastai.imports import *
13
  from tensorflow.keras.models import model_from_json
14
+ from mtcnn.mtcnn import MTCNN
15
 
16
  json_file = open('model.json', 'r')
17
  loaded_model_json = json_file.read()
 
77
  return ("Not in database")
78
 
79
  label = gr.outputs.Label()
80
+ faceModel=MTCNN()
81
  def recog(image):
82
+ faces = faceModel.detect_faces(image)
83
+ for face in faces:
84
+ x,y,w,h = face["box"]
85
  img = image[y:y+h, x:x+w]
86
  if face is not None:
87
  identity=who_is_it(img)