Update app.py
Browse files
app.py
CHANGED
@@ -13,17 +13,18 @@ model = YOLO(model_path)
|
|
13 |
def detect_cheerios(image):
|
14 |
# Run inference on the input image
|
15 |
results = model(image)
|
|
|
16 |
|
17 |
-
# Get the first result (assuming single image input)
|
18 |
-
result = results[0]
|
19 |
|
20 |
-
# Draw bounding boxes on the image
|
21 |
-
for box in result.boxes:
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
return image
|
29 |
|
|
|
13 |
def detect_cheerios(image):
|
14 |
# Run inference on the input image
|
15 |
results = model(image)
|
16 |
+
image = results[0].plot()
|
17 |
|
18 |
+
# # Get the first result (assuming single image input)
|
19 |
+
# result = results[0]
|
20 |
|
21 |
+
# # Draw bounding boxes on the image
|
22 |
+
# for box in result.boxes:
|
23 |
+
# x1, y1, x2, y2 = box.xyxy[0]
|
24 |
+
# conf = box.conf[0]
|
25 |
+
# cv2.rectangle(image, (int(x1), int(y1)), (int(x2), int(y2)), (0, 255, 0), 2)
|
26 |
+
# cv2.putText(image, f'Apple: {conf:.2f}', (int(x1), int(y1) - 10),
|
27 |
+
# cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)
|
28 |
|
29 |
return image
|
30 |
|