oscarfu0501 commited on
Commit
bb5f42d
1 Parent(s): 5725e4c

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -4
handler.py CHANGED
@@ -19,9 +19,9 @@ class EndpointHandler:
19
  # print("Current working directory:", current_directory)
20
 
21
  url = "https://drive.google.com/file/d/1jB8sDYYOTfuF7B1PMcDjkm5R7huv97Wm"
22
- gdown.download(url, './best.pt', quiet=False)
23
 
24
- self.model = YOLO("./best.pt")
25
  def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
26
  inputs = data.get("inputs")
27
  print("in call")
@@ -33,7 +33,7 @@ class EndpointHandler:
33
  print("is path")
34
  print(path)
35
  # path = "http://10.10.2.100/cam-lo.jpg"
36
-
37
  ########################### Load Image #################################
38
  if(isurl): # for url set isurl = 1
39
  print("checkpoint 2-1")
@@ -57,7 +57,7 @@ class EndpointHandler:
57
  # t-shirts-detector/1
58
  # mainmodel/2
59
  #result = self.CLIENT.infer(path, model_id="mainmodel/2")
60
- result = self.model(img)
61
  #annotated_frame = result[0].plot()
62
  detections = result[0].boxes
63
  #print(result[0].boxes.xyxy)
 
19
  # print("Current working directory:", current_directory)
20
 
21
  url = "https://drive.google.com/file/d/1jB8sDYYOTfuF7B1PMcDjkm5R7huv97Wm"
22
+ gdown.download(url, 'best.pt', quiet=False)
23
 
24
+ self.model = YOLO("best.pt")
25
  def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
26
  inputs = data.get("inputs")
27
  print("in call")
 
33
  print("is path")
34
  print(path)
35
  # path = "http://10.10.2.100/cam-lo.jpg"
36
+ model = self.model
37
  ########################### Load Image #################################
38
  if(isurl): # for url set isurl = 1
39
  print("checkpoint 2-1")
 
57
  # t-shirts-detector/1
58
  # mainmodel/2
59
  #result = self.CLIENT.infer(path, model_id="mainmodel/2")
60
+ result = model(img)
61
  #annotated_frame = result[0].plot()
62
  detections = result[0].boxes
63
  #print(result[0].boxes.xyxy)