muhammadsalmanalfaridzi commited on
Commit
667c435
·
verified ·
1 Parent(s): aba3ecb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -96,7 +96,7 @@ def detect_combined(image):
96
  x, y, w, h = pred['x'], pred['y'], pred['width'], pred['height']
97
  cv2.rectangle(img, (int(x - w/2), int(y - h/2)), (int(x + w/2), int(y + h/2)), (0, 255, 0), 2)
98
  cv2.putText(img, pred['class'], (int(x - w/2), int(y - h/2 - 10)),
99
- cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0, 255, 0), 2)
100
 
101
  # Gambar bounding box untuk kompetitor (Merah) dengan label 'unclassified' jika sesuai
102
  for comp in competitor_boxes:
@@ -105,7 +105,7 @@ def detect_combined(image):
105
  display_name = "unclassified" if any(cls in comp['class'].lower() for cls in unclassified_classes) else comp['class']
106
  cv2.rectangle(img, (int(x1), int(y1)), (int(x2), int(y2)), (0, 0, 255), 2)
107
  cv2.putText(img, f"{display_name} {comp['confidence']:.2f}",
108
- (int(x1), int(y1 - 10)), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0, 0, 255), 2)
109
 
110
  output_path = "/tmp/combined_output.jpg"
111
  cv2.imwrite(output_path, img)
 
96
  x, y, w, h = pred['x'], pred['y'], pred['width'], pred['height']
97
  cv2.rectangle(img, (int(x - w/2), int(y - h/2)), (int(x + w/2), int(y + h/2)), (0, 255, 0), 2)
98
  cv2.putText(img, pred['class'], (int(x - w/2), int(y - h/2 - 10)),
99
+ cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
100
 
101
  # Gambar bounding box untuk kompetitor (Merah) dengan label 'unclassified' jika sesuai
102
  for comp in competitor_boxes:
 
105
  display_name = "unclassified" if any(cls in comp['class'].lower() for cls in unclassified_classes) else comp['class']
106
  cv2.rectangle(img, (int(x1), int(y1)), (int(x2), int(y2)), (0, 0, 255), 2)
107
  cv2.putText(img, f"{display_name} {comp['confidence']:.2f}",
108
+ (int(x1), int(y1 - 10)), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 2)
109
 
110
  output_path = "/tmp/combined_output.jpg"
111
  cv2.imwrite(output_path, img)