Spaces:
Build error
Build error
Commit ·
ea3b21c
1
Parent(s): 8f7b62d
fixing api face_recognition route
Browse files- app/api/routes.py +4 -8
app/api/routes.py
CHANGED
|
@@ -226,6 +226,10 @@ def face_recognition(username):
|
|
| 226 |
|
| 227 |
objs_found=face_detector.predict(image)
|
| 228 |
h,w=image.shape[:2]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
tree=fr_helper.objs_found_to_xml("test.jpg",w,h,objs_found)
|
| 231 |
|
|
@@ -241,14 +245,6 @@ def face_recognition(username):
|
|
| 241 |
pred_img=image_to_base64(pred_img)
|
| 242 |
objs_found=fr_helper.xml_to_objs_found(tree) # everything is okay till here
|
| 243 |
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
all_crops=fd_get_crops(image,objs_found)
|
| 247 |
-
all_crops_base64=[]
|
| 248 |
-
|
| 249 |
-
for i,aligned_crop in enumerate(all_crops):
|
| 250 |
-
all_crops_base64.append(image_to_base64(aligned_crop))
|
| 251 |
-
|
| 252 |
person_ids=[obj_found['class'] for obj_found in objs_found]
|
| 253 |
|
| 254 |
return jsonify({"message":"success","pred_image":pred_img,"person_ids":person_ids,"crops":all_crops_base64,"objs_found":objs_found})
|
|
|
|
| 226 |
|
| 227 |
objs_found=face_detector.predict(image)
|
| 228 |
h,w=image.shape[:2]
|
| 229 |
+
all_crops=fd_get_crops(image,objs_found)
|
| 230 |
+
all_crops_base64=[]
|
| 231 |
+
for i,aligned_crop in enumerate(all_crops):
|
| 232 |
+
all_crops_base64.append(image_to_base64(aligned_crop))
|
| 233 |
|
| 234 |
tree=fr_helper.objs_found_to_xml("test.jpg",w,h,objs_found)
|
| 235 |
|
|
|
|
| 245 |
pred_img=image_to_base64(pred_img)
|
| 246 |
objs_found=fr_helper.xml_to_objs_found(tree) # everything is okay till here
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
person_ids=[obj_found['class'] for obj_found in objs_found]
|
| 249 |
|
| 250 |
return jsonify({"message":"success","pred_image":pred_img,"person_ids":person_ids,"crops":all_crops_base64,"objs_found":objs_found})
|