Update handler.py
Browse files17 unmodified lines1819202122238 unmodified lines3233343536372 unmodified lines40414243444517 unmodified lineskey = inputs.get("key")########################### Load Image #################################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)8 unmodified lines# clothing-segmentation-dataset/1# t-shirts-detector/1# mainmodel/2result = CLIENT.infer(path, model_id="mainmodel/2")detections = sv.Detections.from_inference(result)# print(detections)2 unmodified lines########################### Data proccessing ################################## only pass the first detection# change 1 -> to len(detections.xyxy) to pass all photosif detections.confidence.size == 0:return "Not Found"else:17 unmodified lines181920212223248 unmodified lines333435363738392 unmodified lines4243444546474817 unmodified lineskey = inputs.get("key")########################### Load Image #################################CLIENT = InferenceHTTPClient(api_url="https://detect.roboflow.com", api_key=key)print("get client")if isurl: # for url set isurl = 1req = urllib.request.urlopen(path)arr = np.asarray(bytearray(req.read()), dtype=np.uint8)8 unmodified lines# clothing-segmentation-dataset/1# t-shirts-detector/1# mainmodel/2print("start model detection")result = CLIENT.infer(path, model_id="mainmodel/2")detections = sv.Detections.from_inference(result)# print(detections)2 unmodified lines########################### Data proccessing ################################## only pass the first detection# change 1 -> to len(detections.xyxy) to pass all photosprint("Data processing")if detections.confidence.size == 0:return "Not Found"else:
handler.py+3