Upload handler.py
Browse files7 unmodified lines891011121314151617181920212223247 unmodified linesclass EndpointHandler():def __init__(self, key): #pass api key to modelself.CLIENT = InferenceHTTPClient(api_url="https://detect.roboflow.com",api_key=key)print(key)def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:inputs = data.get("inputs")isurl = inputs.get("isurl")path = inputs.get("path")########################### Load Image #################################if(isurl): # for url set isurl = 1req = urllib.request.urlopen(path)arr = np.asarray(bytearray(req.read()), dtype=np.uint8)7 unmodified lines89101112131415161718192021222324257 unmodified linesclass EndpointHandler():def __init__(self, key): #pass api key to modelpassdef __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:inputs = data.get("inputs")isurl = inputs.get("isurl")path = inputs.get("path")key = inputs.get("key")########################### Load Image #################################self.CLIENT = InferenceHTTPClient(api_url="https://detect.roboflow.com",api_key=key)if(isurl): # for url set isurl = 1req = urllib.request.urlopen(path)arr = np.asarray(bytearray(req.read()), dtype=np.uint8)
handler.py+6-5