1ngsm0del commited on
Commit
87a29e4
1 Parent(s): d16ee9e

Modify app.py to show Annotated results multiple lines instead list

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -19,15 +19,16 @@ def yolov10_inference(image, video, image_size, conf_threshold, iou_threshold):
19
  box = results[0].boxes
20
  cls = [int(c) for c in box.cls.tolist()]
21
  cnf = [round(f,2) for f in box.conf.tolist()]
22
- name = [df[df['class']==n]['name'].item() for n in cls]
 
23
  # print(cls)
24
  # print(name)
25
- # print(list(zip(cls, cnf)))
26
  # print("Object type:", box.cls)
27
  # print("Coordinates:", box.xyxy)
28
  # print("Probability:", box.conf)
29
  # print('box.class data tyupe', type(box.cls.tolist()))
30
- return annotated_image[:, :, ::-1], None, list(zip(cls,cnf)), name
31
  else:
32
  video_path = tempfile.mktemp(suffix=".webm")
33
  with open(video_path, "wb") as f:
 
19
  box = results[0].boxes
20
  cls = [int(c) for c in box.cls.tolist()]
21
  cnf = [round(f,2) for f in box.conf.tolist()]
22
+ clcf = '\n'.join([f'Class:{cls[i]} , Confidence:{cnf[i]*100}%' for i in range(len(cls))]) #list(zip(cls,cnf))
23
+ name = '\n'.join([df[df['class']==n]['name'].item() for n in cls])
24
  # print(cls)
25
  # print(name)
26
+ print(type(clcf))
27
  # print("Object type:", box.cls)
28
  # print("Coordinates:", box.xyxy)
29
  # print("Probability:", box.conf)
30
  # print('box.class data tyupe', type(box.cls.tolist()))
31
+ return annotated_image[:, :, ::-1], None, clcf, name
32
  else:
33
  video_path = tempfile.mktemp(suffix=".webm")
34
  with open(video_path, "wb") as f: