Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,9 +59,9 @@ def prod_function(app, prod_path, webcam_img_pil):
|
|
| 59 |
# Get coordinates
|
| 60 |
x1, y1, x2, y2 = [int(i) for i in webcam_face.bbox]
|
| 61 |
if best_score >= 0.6:
|
| 62 |
-
|
| 63 |
else:
|
| 64 |
-
|
| 65 |
results.append({'bbox': (x1, y1, x2, y2), 'name': name})
|
| 66 |
|
| 67 |
|
|
@@ -101,7 +101,7 @@ with app_tab:
|
|
| 101 |
cv2.rectangle(image_bgr, (x1, y1), (x2, y2), color, 2)
|
| 102 |
cv2.putText(image_bgr, name, (x1, y2 + 20), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2)
|
| 103 |
|
| 104 |
-
if
|
| 105 |
# recognized = False
|
| 106 |
# for score, idx in matches:
|
| 107 |
# if matched_score >= 0.6:
|
|
|
|
| 59 |
# Get coordinates
|
| 60 |
x1, y1, x2, y2 = [int(i) for i in webcam_face.bbox]
|
| 61 |
if best_score >= 0.6:
|
| 62 |
+
matched_name = os.path.basename(prod_path[best_match_idx]).split('.')[0]
|
| 63 |
else:
|
| 64 |
+
matched_name = "Unknown"
|
| 65 |
results.append({'bbox': (x1, y1, x2, y2), 'name': name})
|
| 66 |
|
| 67 |
|
|
|
|
| 101 |
cv2.rectangle(image_bgr, (x1, y1), (x2, y2), color, 2)
|
| 102 |
cv2.putText(image_bgr, name, (x1, y2 + 20), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2)
|
| 103 |
|
| 104 |
+
if matched_name != "Unknown":
|
| 105 |
# recognized = False
|
| 106 |
# for score, idx in matches:
|
| 107 |
# if matched_score >= 0.6:
|