justin2341 commited on
Commit
c9efd2c
·
verified ·
1 Parent(s): a22dc01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -13
app.py CHANGED
@@ -134,26 +134,22 @@ def compare_face():
134
  response.status_code = 200
135
  response.headers["Content-Type"] = "application/json; charset=utf-8"
136
  return response
137
- elif faceNum1 == 0:
138
- response = jsonify({"resultCode": "No face1", "faces1": faces1, "faces2": faces2})
139
 
140
  response.status_code = 200
141
  response.headers["Content-Type"] = "application/json; charset=utf-8"
142
  return response
143
- elif faceNum2 == 0:
144
- response = jsonify({"resultCode": "No face2", "faces1": faces1, "faces2": faces2})
145
 
146
  response.status_code = 200
147
  response.headers["Content-Type"] = "application/json; charset=utf-8"
148
  return response
 
149
 
150
  @app.route('/compare_face_base64', methods=['POST'])
151
  def compare_face_base64():
152
- result = "None"
153
- similarity = -1
154
- face1 = None
155
- face2 = None
156
-
157
  content = request.get_json()
158
 
159
  try:
@@ -190,6 +186,7 @@ def compare_face_base64():
190
  faceCount2 = faceDetection(image_np2, image_np2.shape[1], image_np2.shape[0], faceBoxes2, maxFaceCount)
191
 
192
  faces1_result = []
 
193
  for i in range(faceCount1):
194
  templateExtraction(image_np1, image_np1.shape[1], image_np1.shape[0], faceBoxes1[i])
195
 
@@ -237,14 +234,14 @@ def compare_face_base64():
237
  response.status_code = 200
238
  response.headers["Content-Type"] = "application/json; charset=utf-8"
239
  return response
240
- elif faceNum1 == 0:
241
- response = jsonify({"resultCode": "No face1", "faces1": faces1, "faces2": faces2})
242
 
243
  response.status_code = 200
244
  response.headers["Content-Type"] = "application/json; charset=utf-8"
245
  return response
246
- elif faceNum2 == 0:
247
- response = jsonify({"resultCode": "No face2", "faces1": faces1, "faces2": faces2})
248
 
249
  response.status_code = 200
250
  response.headers["Content-Type"] = "application/json; charset=utf-8"
 
134
  response.status_code = 200
135
  response.headers["Content-Type"] = "application/json; charset=utf-8"
136
  return response
137
+ elif faceCount1 == 0:
138
+ response = jsonify({"resultCode": "No face1", "faces1": faces1_result, "faces2": faces2_result})
139
 
140
  response.status_code = 200
141
  response.headers["Content-Type"] = "application/json; charset=utf-8"
142
  return response
143
+ elif faceCount2 == 0:
144
+ response = jsonify({"resultCode": "No face2", "faces1": faces1_result, "faces2": faces2_result})
145
 
146
  response.status_code = 200
147
  response.headers["Content-Type"] = "application/json; charset=utf-8"
148
  return response
149
+
150
 
151
  @app.route('/compare_face_base64', methods=['POST'])
152
  def compare_face_base64():
 
 
 
 
 
153
  content = request.get_json()
154
 
155
  try:
 
186
  faceCount2 = faceDetection(image_np2, image_np2.shape[1], image_np2.shape[0], faceBoxes2, maxFaceCount)
187
 
188
  faces1_result = []
189
+ faces2_result = []
190
  for i in range(faceCount1):
191
  templateExtraction(image_np1, image_np1.shape[1], image_np1.shape[0], faceBoxes1[i])
192
 
 
234
  response.status_code = 200
235
  response.headers["Content-Type"] = "application/json; charset=utf-8"
236
  return response
237
+ elif faceCount1 == 0:
238
+ response = jsonify({"resultCode": "No face1", "faces1": faces1_result, "faces2": faces2_result})
239
 
240
  response.status_code = 200
241
  response.headers["Content-Type"] = "application/json; charset=utf-8"
242
  return response
243
+ elif faceCount2 == 0:
244
+ response = jsonify({"resultCode": "No face2", "faces1": faces1_result, "faces2": faces2_result})
245
 
246
  response.status_code = 200
247
  response.headers["Content-Type"] = "application/json; charset=utf-8"