Upload handler.py
Browse files7 unmodified lines891011121314151112131415161718192021222324257 unmodified lines
class EndpointHandler(): def __init__(self, key): #pass api key to model self.CLIENT = InferenceHTTPClient( api_url="https://detect.roboflow.com", api_key=key ) print(key) pass def __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 = 1 req = urllib.request.urlopen(path) arr = np.asarray(bytearray(req.read()), dtype=np.uint8)handler.py+6-5