linhcuem commited on
Commit
e141787
1 Parent(s): daf6e18

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -16
app.py CHANGED
@@ -65,28 +65,15 @@ def yolov8_img_inference(
65
  object_counts[c] += 1
66
  elif c not in names:
67
  object_counts[c] = 1
68
- # clist = results[0].boxes.cls
69
- # cls = set()
70
- # for cno in clist:
71
- # cls.add(model.names[int(cno)])
72
- # if cno in names:
73
- # object_counts[cno] += 1
74
- # elif cno not in names:
75
- # object_counts[cno] = 1
76
  present_objects = object_counts.copy()
77
 
78
  for i in object_counts:
79
  if object_counts[i] < 1:
80
  present_objects.pop(i)
81
 
82
- # clist= results[0].boxes.cls.tolist()
83
- # cls = set()
84
- # for cno in clist:
85
- # cls.add(model.names[int(cno)])
86
-
87
- # count_result = results.pandas().xyxy[0].value_counts('name')
88
- # return render, present_objects
89
- return render, {names[k]: v for k, v in present_objects.items()}
90
  # results = model.predict(image, imgsz=image_size, return_outputs=True)
91
  # results = model.predict(image)
92
  # object_prediction_list = []
 
65
  object_counts[c] += 1
66
  elif c not in names:
67
  object_counts[c] = 1
68
+
 
 
 
 
 
 
 
69
  present_objects = object_counts.copy()
70
 
71
  for i in object_counts:
72
  if object_counts[i] < 1:
73
  present_objects.pop(i)
74
 
75
+
76
+ return render, {names[k]: v for k, v in present_objects}
 
 
 
 
 
 
77
  # results = model.predict(image, imgsz=image_size, return_outputs=True)
78
  # results = model.predict(image)
79
  # object_prediction_list = []