HilmiZr commited on
Commit
2f7a13e
·
1 Parent(s): e356276

back to stable

Browse files
Files changed (1) hide show
  1. app.py +0 -26
app.py CHANGED
@@ -41,8 +41,6 @@ def show_preds_image(image_path):
41
  outputs = model.predict(source=image_path)
42
  results = outputs[0].cpu().numpy()
43
  for i, det in enumerate(results.boxes.xyxy):
44
- class_index = det[4].astype(int)
45
- label = results.names[class_index]
46
  cv2.rectangle(
47
  image,
48
  (int(det[0]), int(det[1])),
@@ -51,21 +49,9 @@ def show_preds_image(image_path):
51
  thickness=2,
52
  lineType=cv2.LINE_AA
53
  )
54
- cv2.putText(
55
- image,
56
- label,
57
- (int(det[0]), int(det[1] - 10)),
58
- cv2.FONT_HERSHEY_SIMPLEX,
59
- 0.5,
60
- (255, 255, 255),
61
- 2,
62
- lineType=cv2.LINE_AA
63
- )
64
  return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
65
 
66
 
67
-
68
-
69
  inputs_image = [
70
  gr.components.Image(type="filepath", label="Input Image"),
71
  ]
@@ -91,8 +77,6 @@ def show_preds_video(video_path):
91
  outputs = model.predict(source=frame)
92
  results = outputs[0].cpu().numpy()
93
  for i, det in enumerate(results.boxes.xyxy):
94
- class_index = results.names[i]
95
- label = class_index
96
  cv2.rectangle(
97
  frame_copy,
98
  (int(det[0]), int(det[1])),
@@ -101,16 +85,6 @@ def show_preds_video(video_path):
101
  thickness=2,
102
  lineType=cv2.LINE_AA
103
  )
104
- cv2.putText(
105
- frame_copy,
106
- label,
107
- (int(det[0]), int(det[1] - 10)),
108
- cv2.FONT_HERSHEY_SIMPLEX,
109
- 0.5,
110
- (255, 255, 255),
111
- 2,
112
- lineType=cv2.LINE_AA
113
- )
114
  yield cv2.cvtColor(frame_copy, cv2.COLOR_BGR2RGB)
115
 
116
 
 
41
  outputs = model.predict(source=image_path)
42
  results = outputs[0].cpu().numpy()
43
  for i, det in enumerate(results.boxes.xyxy):
 
 
44
  cv2.rectangle(
45
  image,
46
  (int(det[0]), int(det[1])),
 
49
  thickness=2,
50
  lineType=cv2.LINE_AA
51
  )
 
 
 
 
 
 
 
 
 
 
52
  return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
53
 
54
 
 
 
55
  inputs_image = [
56
  gr.components.Image(type="filepath", label="Input Image"),
57
  ]
 
77
  outputs = model.predict(source=frame)
78
  results = outputs[0].cpu().numpy()
79
  for i, det in enumerate(results.boxes.xyxy):
 
 
80
  cv2.rectangle(
81
  frame_copy,
82
  (int(det[0]), int(det[1])),
 
85
  thickness=2,
86
  lineType=cv2.LINE_AA
87
  )
 
 
 
 
 
 
 
 
 
 
88
  yield cv2.cvtColor(frame_copy, cv2.COLOR_BGR2RGB)
89
 
90