Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -62,7 +62,7 @@ def prod_function(app, prod_path, webcam_img_pil):
|
|
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':
|
66 |
|
67 |
|
68 |
return results, cv2_webcam
|
@@ -97,9 +97,9 @@ with app_tab:
|
|
97 |
for match in matches:
|
98 |
x1, y1, x2, y2 = match['bbox']
|
99 |
matched_name = match['name']
|
100 |
-
color = (0, 255, 0) if
|
101 |
cv2.rectangle(image_bgr, (x1, y1), (x2, y2), color, 2)
|
102 |
-
cv2.putText(image_bgr,
|
103 |
|
104 |
if matched_name != "Unknown":
|
105 |
# recognized = False
|
|
|
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': matched_name})
|
66 |
|
67 |
|
68 |
return results, cv2_webcam
|
|
|
97 |
for match in matches:
|
98 |
x1, y1, x2, y2 = match['bbox']
|
99 |
matched_name = match['name']
|
100 |
+
color = (0, 255, 0) if matched_name != "Unknown" else (0, 0, 255)
|
101 |
cv2.rectangle(image_bgr, (x1, y1), (x2, y2), color, 2)
|
102 |
+
cv2.putText(image_bgr, matched_name, (x1, y2 + 20), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2)
|
103 |
|
104 |
if matched_name != "Unknown":
|
105 |
# recognized = False
|