Skip to content

Commit e97cde2

Browse files
authored
Merge pull request #5 from cosmic-byte/staging
refactor json result object
2 parents f481b45 + 590628f commit e97cde2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

webService/app/module_one/views.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ def allowed_file(filename):
4343

4444
def process_images(file, file2):
4545

46-
face_match = False
46+
_match = False
4747
known_image = face_recognition.load_image_file(file)
4848
unknown_image = face_recognition.load_image_file(file2)
4949
known_face_locations = face_recognition.face_locations(known_image)
5050
unknown_face_locations = face_recognition.face_locations(unknown_image)
5151

5252
if len(known_face_locations) == 0:
5353
result = {
54-
"faces-match": face_match,
54+
"facesMatch": _match,
5555
"error": "no face found",
5656
"code": "500"
5757
}
5858
return jsonify(result)
5959
elif len(unknown_face_locations) == 0:
6060
result = {
61-
"faces-match": face_match,
61+
"facesMatch": _match,
6262
"error": "no face found",
6363
"code": "500"
6464
}
@@ -68,10 +68,10 @@ def process_images(file, file2):
6868
unknown_face_encodings = face_recognition.face_encodings(unknown_image, unknown_face_locations)
6969
match = face_recognition.compare_faces([known_face_encodings], unknown_face_encodings[0], 0.50)
7070
if match[0]:
71-
face_match = True
71+
_match = True
7272
# Return the result as json
7373
result = {
74-
"faces-match": face_match,
74+
"facesMatch": _match,
7575
"error": "",
7676
"code": "200"
7777
}

0 commit comments

Comments
 (0)