Commit
·
8ab6d35
1
Parent(s):
a8bc875
Update handler.py
Browse files- handler.py +5 -5
handler.py
CHANGED
@@ -23,16 +23,16 @@ class EndpointHandler():
|
|
23 |
def __call__(self, data: Dict) -> Dict:
|
24 |
|
25 |
# logging.info(f'Value of data is : {data}')
|
26 |
-
|
27 |
-
|
28 |
image_url = data.get('image_url')
|
29 |
-
|
30 |
response = requests.get(image_url)
|
31 |
pil_image = Image.open(BytesIO(response.content))
|
32 |
|
33 |
-
|
34 |
t1 = time.time()
|
35 |
results = self.model(pil_image)
|
36 |
-
|
37 |
# postprocess the prediction -> results[0].boxes.data.tolist()
|
38 |
return {"bbox": results[0].boxes.data.tolist()}
|
|
|
23 |
def __call__(self, data: Dict) -> Dict:
|
24 |
|
25 |
# logging.info(f'Value of data is : {data}')
|
26 |
+
logging.info(f'data: {data}')
|
27 |
+
logging.info(f'type of data: {type(data)}')
|
28 |
image_url = data.get('image_url')
|
29 |
+
logging.info(f'Image url is : {image_url}')
|
30 |
response = requests.get(image_url)
|
31 |
pil_image = Image.open(BytesIO(response.content))
|
32 |
|
33 |
+
logging.info('Model inference started....')
|
34 |
t1 = time.time()
|
35 |
results = self.model(pil_image)
|
36 |
+
logging.info(f'TIME Model inference: {time.time() - t1}')
|
37 |
# postprocess the prediction -> results[0].boxes.data.tolist()
|
38 |
return {"bbox": results[0].boxes.data.tolist()}
|