Update handler.py
Browse files18 unmodified lines1920212223242526272848 unmodified lines777879808182838485868788899018 unmodified linesself.model = YOLO("./best.pt")def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:os.getcwd()inputs = data.get("inputs")isurl = inputs.get("isurl")path = inputs.get("path")# path = "http://10.10.2.100/cam-lo.jpg"model = self.model48 unmodified lines# cv2.imwrite("result.jpg", clothes)# create base 64 objectjpg_as_text = base64.b64encode(buffer).decode("utf-8") # Decode bytes to string")# base64_encoded = base64.b64encode(image_bytes).decode("utf-8")# Get the image formatimage_format = Image.open(io.BytesIO(buffer)).format.lower()# Construct the data URIdata_uri = f"data:image/{image_format};base64,{jpg_as_text}"# return data_uriprint("checkpoint 4")18 unmodified lines1920212223242526272848 unmodified lines777879808182838485868788899018 unmodified linesself.model = YOLO("./best.pt")def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:inputs = data.get("inputs")isurl = inputs.get("isurl")path = inputs.get("path")print(path)# path = "http://10.10.2.100/cam-lo.jpg"model = self.model48 unmodified lines# cv2.imwrite("result.jpg", clothes)# create base 64 object# jpg_as_text = base64.b64encode(buffer).decode("utf-8") # Decode bytes to string")jpg_as_text = base64.b64encode(buffer).decode("utf-8")# Get the image format# image_format = Image.open(io.BytesIO(buffer)).format.lower()# Construct the data URI# data_uri = f"data:image/{image_format};base64,{jpg_as_text}"# return data_uriprint("checkpoint 4")
handler.py+5-5