AdrielAmoguis commited on
Commit
041a7e2
·
1 Parent(s): a5fd6f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -29,11 +29,10 @@ def snap(image, model, conf, iou):
29
  probs = result.boxes.conf.cpu().numpy()
30
  boxes = result.boxes.xyxy[0].cpu().numpy()
31
 
32
- for i in range(len(boxes)):
33
- x1, y1, x2, y2 = boxes[i]
34
- x1, y1, x2, y2 = int(x1), int(y1), int(x2), int(y2)
35
- cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)
36
- cv2.putText(image, f"{classes[i]} {probs[i]:.2f}", (x1, y1), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)
37
 
38
  # Convert the resulting image to a PIL image
39
  resulting_image = Image.fromarray(image)
 
29
  probs = result.boxes.conf.cpu().numpy()
30
  boxes = result.boxes.xyxy[0].cpu().numpy()
31
 
32
+ x1, y1, x2, y2 = boxes
33
+ x1, y1, x2, y2 = int(x1), int(y1), int(x2), int(y2)
34
+ cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)
35
+ cv2.putText(image, f"{classes} {probs:.2f}", (x1, y1), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)
 
36
 
37
  # Convert the resulting image to a PIL image
38
  resulting_image = Image.fromarray(image)