oscarfu0501 commited on
Commit
bb2a943
1 Parent(s): 113ea05

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +5 -5
handler.py CHANGED
@@ -19,10 +19,10 @@ class EndpointHandler:
19
 
20
  self.model = YOLO("./best.pt")
21
  def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
22
- os.getcwd()
23
  inputs = data.get("inputs")
24
  isurl = inputs.get("isurl")
25
  path = inputs.get("path")
 
26
  # path = "http://10.10.2.100/cam-lo.jpg"
27
 
28
  model = self.model
@@ -77,14 +77,14 @@ class EndpointHandler:
77
 
78
  # cv2.imwrite("result.jpg", clothes)
79
  # create base 64 object
80
- jpg_as_text = base64.b64encode(buffer).decode("utf-8") # Decode bytes to string")
81
- # base64_encoded = base64.b64encode(image_bytes).decode("utf-8")
82
 
83
  # Get the image format
84
- image_format = Image.open(io.BytesIO(buffer)).format.lower()
85
 
86
  # Construct the data URI
87
- data_uri = f"data:image/{image_format};base64,{jpg_as_text}"
88
 
89
  # return data_uri
90
  print("checkpoint 4")
 
19
 
20
  self.model = YOLO("./best.pt")
21
  def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
 
22
  inputs = data.get("inputs")
23
  isurl = inputs.get("isurl")
24
  path = inputs.get("path")
25
+ print(path)
26
  # path = "http://10.10.2.100/cam-lo.jpg"
27
 
28
  model = self.model
 
77
 
78
  # cv2.imwrite("result.jpg", clothes)
79
  # create base 64 object
80
+ # jpg_as_text = base64.b64encode(buffer).decode("utf-8") # Decode bytes to string")
81
+ jpg_as_text = base64.b64encode(buffer).decode("utf-8")
82
 
83
  # Get the image format
84
+ # image_format = Image.open(io.BytesIO(buffer)).format.lower()
85
 
86
  # Construct the data URI
87
+ # data_uri = f"data:image/{image_format};base64,{jpg_as_text}"
88
 
89
  # return data_uri
90
  print("checkpoint 4")