Vikas01 commited on
Commit
bfc3611
·
1 Parent(s): 444610b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -28
app.py CHANGED
@@ -93,43 +93,27 @@ def receive_image(image):
93
  # rgb_small_frame = small_frame[:, :, ::-1]
94
  # # emit("result",{"name":"level " +str(cnt),"score":str(len(face_encodings))})
95
 
96
- # face_locations = face_recognition.face_locations(rgb_small_frame)
97
- # face_encodings = face_recognition.face_encodings(small_frame, face_locations)
98
- # face_names = []
99
- # emit("result",{"name":"level2 " +str(cnt),"score":str(len(face_encodings))})
100
- # cnt = cnt +1
101
- # for face_encoding in face_encodings:
102
- # # emit("result",{"name":"in for ","score":"34"})
103
- # matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
104
- # name = ""
105
- # face_distance = face_recognition.face_distance(known_face_encodings, face_encoding)
106
- # best_match_index = np.argmin(face_distance)
107
- # if matches[best_match_index]:
108
- # name = known_faces_names[best_match_index]
109
-
110
- # face_names.append(name)
111
- # s = False
112
- # break
113
-
114
- # emit("result",{"name":str(name),"score":"myScore"})
115
-
116
- name = "" # Initialize name with a default value
117
-
118
  for face_encoding in face_encodings:
 
119
  matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
 
120
  face_distance = face_recognition.face_distance(known_face_encodings, face_encoding)
121
  best_match_index = np.argmin(face_distance)
122
  if matches[best_match_index]:
123
  name = known_faces_names[best_match_index]
124
-
125
  face_names.append(name)
126
  s = False
127
  break
128
-
129
- cnt = cnt + 1
130
-
131
- emit("result", {"name": str(name), "score": "myScore"})
132
- emit("result", {"name": "level1", "score": "34"})
133
 
134
 
135
  # # for name in face_names:
 
93
  # rgb_small_frame = small_frame[:, :, ::-1]
94
  # # emit("result",{"name":"level " +str(cnt),"score":str(len(face_encodings))})
95
 
96
+ face_locations = face_recognition.face_locations(rgb_small_frame)
97
+ face_encodings = face_recognition.face_encodings(small_frame, face_locations)
98
+ face_names = []
99
+ emit("result",{"name":"level2 " +str(cnt),"score":str(len(face_encodings))})
100
+ cnt = cnt +1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  for face_encoding in face_encodings:
102
+ # emit("result",{"name":"in for ","score":"34"})
103
  matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
104
+ name = ""
105
  face_distance = face_recognition.face_distance(known_face_encodings, face_encoding)
106
  best_match_index = np.argmin(face_distance)
107
  if matches[best_match_index]:
108
  name = known_faces_names[best_match_index]
109
+
110
  face_names.append(name)
111
  s = False
112
  break
113
+
114
+ emit("result",{"name":str(name),"score":"myScore"})
115
+
116
+
 
117
 
118
 
119
  # # for name in face_names: