Update handler.py
Browse files- handler.py +6 -2
handler.py
CHANGED
|
@@ -20,12 +20,16 @@ class EndpointHandler:
|
|
| 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
|
| 29 |
########################### Load Image #################################
|
| 30 |
if(isurl): # for url set isurl = 1
|
| 31 |
print("checkpoint 2-1")
|
|
@@ -49,7 +53,7 @@ class EndpointHandler:
|
|
| 49 |
# t-shirts-detector/1
|
| 50 |
# mainmodel/2
|
| 51 |
#result = self.CLIENT.infer(path, model_id="mainmodel/2")
|
| 52 |
-
result = model(img)
|
| 53 |
#annotated_frame = result[0].plot()
|
| 54 |
detections = result[0].boxes
|
| 55 |
#print(result[0].boxes.xyxy)
|
|
|
|
| 20 |
self.model = YOLO("./best.pt")
|
| 21 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
| 22 |
inputs = data.get("inputs")
|
| 23 |
+
print("in call")
|
| 24 |
+
|
| 25 |
isurl = inputs.get("isurl")
|
| 26 |
+
print("in isurl")
|
| 27 |
+
|
| 28 |
path = inputs.get("path")
|
| 29 |
+
print("is path")
|
| 30 |
print(path)
|
| 31 |
# path = "http://10.10.2.100/cam-lo.jpg"
|
| 32 |
|
|
|
|
| 33 |
########################### Load Image #################################
|
| 34 |
if(isurl): # for url set isurl = 1
|
| 35 |
print("checkpoint 2-1")
|
|
|
|
| 53 |
# t-shirts-detector/1
|
| 54 |
# mainmodel/2
|
| 55 |
#result = self.CLIENT.infer(path, model_id="mainmodel/2")
|
| 56 |
+
result = self.model(img)
|
| 57 |
#annotated_frame = result[0].plot()
|
| 58 |
detections = result[0].boxes
|
| 59 |
#print(result[0].boxes.xyxy)
|