muhammadsalmanalfaridzi commited on
Commit
d2c5459
·
verified ·
1 Parent(s): 381bc65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -17,7 +17,7 @@ workspace = os.getenv("ROBOFLOW_WORKSPACE")
17
  project_name = os.getenv("ROBOFLOW_PROJECT")
18
  model_version = int(os.getenv("ROBOFLOW_MODEL_VERSION"))
19
 
20
- # CountGD Config (Replace DINO-X)
21
  COUNTGD_API_KEY = os.getenv("COUNTGD_API_KEY")
22
 
23
  # Inisialisasi YOLO Model dari Roboflow
@@ -86,7 +86,7 @@ def detect_combined(image):
86
  url = "https://api.landing.ai/v1/tools/text-to-object-detection"
87
  headers = {"Authorization": f"Basic {COUNTGD_API_KEY}"}
88
  competitor_boxes = []
89
- COUNTGD_PROMPTS = ["cans", "bottle", "beverage"]
90
 
91
  for prompt in COUNTGD_PROMPTS:
92
  with open(temp_path, "rb") as f:
@@ -122,13 +122,13 @@ def detect_combined(image):
122
  pt2 = (int(x + w/2), int(y + h/2))
123
  cv2.rectangle(img, pt1, pt2, (0, 255, 0), 2)
124
  cv2.putText(img, pred['class'], (pt1[0], pt1[1]-10),
125
- cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0,255,0), 3)
126
  # Gambar bounding box CountGD (merah)
127
  for box in competitor_boxes:
128
  x1, y1, x2, y2 = box
129
  cv2.rectangle(img, (int(x1), int(y1)), (int(x2), int(y2)), (0, 0, 255), 2)
130
  cv2.putText(img, "unclassified", (int(x1), int(y1)-10),
131
- cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0,0,255), 3)
132
 
133
  output_path = "/tmp/combined_output.jpg"
134
  cv2.imwrite(output_path, img)
 
17
  project_name = os.getenv("ROBOFLOW_PROJECT")
18
  model_version = int(os.getenv("ROBOFLOW_MODEL_VERSION"))
19
 
20
+ # CountGD Config
21
  COUNTGD_API_KEY = os.getenv("COUNTGD_API_KEY")
22
 
23
  # Inisialisasi YOLO Model dari Roboflow
 
86
  url = "https://api.landing.ai/v1/tools/text-to-object-detection"
87
  headers = {"Authorization": f"Basic {COUNTGD_API_KEY}"}
88
  competitor_boxes = []
89
+ COUNTGD_PROMPTS = ["cans", "bottle", "beverage", "mixed box"]
90
 
91
  for prompt in COUNTGD_PROMPTS:
92
  with open(temp_path, "rb") as f:
 
122
  pt2 = (int(x + w/2), int(y + h/2))
123
  cv2.rectangle(img, pt1, pt2, (0, 255, 0), 2)
124
  cv2.putText(img, pred['class'], (pt1[0], pt1[1]-10),
125
+ cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0,255,0), 3)
126
  # Gambar bounding box CountGD (merah)
127
  for box in competitor_boxes:
128
  x1, y1, x2, y2 = box
129
  cv2.rectangle(img, (int(x1), int(y1)), (int(x2), int(y2)), (0, 0, 255), 2)
130
  cv2.putText(img, "unclassified", (int(x1), int(y1)-10),
131
+ cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0,0,255), 3)
132
 
133
  output_path = "/tmp/combined_output.jpg"
134
  cv2.imwrite(output_path, img)