Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,11 +28,13 @@ def detect_pcb_faults(image):
|
|
| 28 |
|
| 29 |
# ✅ Draw bounding boxes and labels
|
| 30 |
for (x1, y1, x2, y2), conf, class_id in zip(boxes, confs, class_ids):
|
| 31 |
-
cv2.rectangle(image, (int(x1), int(y1)), (int(x2), int(y2)), (0, 255, 0),
|
| 32 |
|
| 33 |
# Get class label from dictionary
|
| 34 |
label = f"{class_names.get(int(class_id), 'Unknown')} ({conf:.2f})"
|
| 35 |
-
|
|
|
|
|
|
|
| 36 |
|
| 37 |
return image
|
| 38 |
|
|
|
|
| 28 |
|
| 29 |
# ✅ Draw bounding boxes and labels
|
| 30 |
for (x1, y1, x2, y2), conf, class_id in zip(boxes, confs, class_ids):
|
| 31 |
+
cv2.rectangle(image, (int(x1), int(y1)), (int(x2), int(y2)), (0, 255, 0), 3) # 🟢 Thicker Box
|
| 32 |
|
| 33 |
# Get class label from dictionary
|
| 34 |
label = f"{class_names.get(int(class_id), 'Unknown')} ({conf:.2f})"
|
| 35 |
+
|
| 36 |
+
# 🔥 Larger Text Size & Thicker Font
|
| 37 |
+
cv2.putText(image, label, (int(x1), int(y1) - 10), cv2.FONT_HERSHEY_SIMPLEX, 1.2, (0, 255, 0), 3)
|
| 38 |
|
| 39 |
return image
|
| 40 |
|