kedimestan commited on
Commit
e472bb3
1 Parent(s): 3228b30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -43,13 +43,13 @@ def yolov8_inference(
43
  model.overrides["conf"] = conf_threshold
44
  model.overrides["iou"] = iou_threshold
45
  results = model.predict(image, imgsz=image_size)
46
-
47
- boxes1 = []
48
- for result in results:
49
- # Extract bounding boxes (xyxy format)
50
- for i,box in enumerate(result.boxes):
51
- boxes1.append(box.xyxy[0].tolist())
52
- return boxes1
53
 
54
 
55
  inputs = [
 
43
  model.overrides["conf"] = conf_threshold
44
  model.overrides["iou"] = iou_threshold
45
  results = model.predict(image, imgsz=image_size)
46
+
47
+ outputs=[]
48
+ for i,box in enumerate(results[0].boxes):
49
+ label = results[0].names[box.cls[0].item()]
50
+ bbox = box.xyxy[0]
51
+ output.append({"label": label, "bbox_coords": bbox})
52
+ return output
53
 
54
 
55
  inputs = [