English
detection
open-world
open-set
Inference Endpoints
kelvinou01 commited on
Commit
13ea7e7
1 Parent(s): 841a649

Add num_found

Browse files
Files changed (1) hide show
  1. handler.py +2 -2
handler.py CHANGED
@@ -13,9 +13,7 @@ HOME = os.getcwd()
13
 
14
  # /opt/conda/lib/python3.9/site-packages/groundingdino
15
  PACKAGE_HOME = os.path.dirname(groundingdino.__file__)
16
-
17
  CONFIG_PATH = os.path.join(PACKAGE_HOME, "config", "GroundingDINO_SwinT_OGC.py")
18
- WEIGHTS_PATH = os.path.join("model", "weights", "groundingdino_swint_ogc.pth")
19
 
20
  class EndpointHandler():
21
  def __init__(self, path):
@@ -53,8 +51,10 @@ class EndpointHandler():
53
  annotated_frame = annotate(image_source=image_source, boxes=boxes, logits=logits, phrases=phrases)
54
  _, annotated_image = cv2.imencode(".jpg", annotated_frame)
55
  annotated_image_b64 = base64.b64encode(annotated_image).decode("utf-8")
 
56
 
57
  return [{
58
  "image": annotated_image_b64,
59
  "prompt": prompt,
 
60
  }]
 
13
 
14
  # /opt/conda/lib/python3.9/site-packages/groundingdino
15
  PACKAGE_HOME = os.path.dirname(groundingdino.__file__)
 
16
  CONFIG_PATH = os.path.join(PACKAGE_HOME, "config", "GroundingDINO_SwinT_OGC.py")
 
17
 
18
  class EndpointHandler():
19
  def __init__(self, path):
 
51
  annotated_frame = annotate(image_source=image_source, boxes=boxes, logits=logits, phrases=phrases)
52
  _, annotated_image = cv2.imencode(".jpg", annotated_frame)
53
  annotated_image_b64 = base64.b64encode(annotated_image).decode("utf-8")
54
+ num_found = boxes.size[0]
55
 
56
  return [{
57
  "image": annotated_image_b64,
58
  "prompt": prompt,
59
+ "num_found": num_found,
60
  }]