skumar1998 commited on
Commit
c8ae6b5
·
1 Parent(s): 4504977

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +6 -5
handler.py CHANGED
@@ -4,16 +4,17 @@ import requests
4
  from io import BytesIO
5
  from PIL import Image
6
  import time
 
7
  import os
8
 
9
 
10
  class EndpointHandler():
11
  def __init__(self, path=""):
12
  # load the model
13
- print(f'value of path is : {path}')
14
  current_directory = os.getcwd()
15
- print(f'current dir: {current_directory}')
16
- print(f'all files: {os.listdir(current_directory)}')
17
  # model_path = "yolov8m_detect_usdl.pt"
18
  # self.model = YOLO(model_path)
19
  # print('Yolo model loaded successfully')
@@ -21,7 +22,7 @@ class EndpointHandler():
21
 
22
  def __call__(self, data: Dict) -> Dict:
23
 
24
- print(f'Value of data is : {data}')
25
 
26
  # image_url = data.get('image_url')
27
  # print(f'Image url is : {image_url}')
@@ -33,4 +34,4 @@ class EndpointHandler():
33
  # results = self.model(pil_image)
34
  # print(f'TIME Model inference: {time.time() - t1}')
35
  # postprocess the prediction -> results[0].boxes.data.tolist()
36
- return {"bbox": 'data'}
 
4
  from io import BytesIO
5
  from PIL import Image
6
  import time
7
+ import logging
8
  import os
9
 
10
 
11
  class EndpointHandler():
12
  def __init__(self, path=""):
13
  # load the model
14
+ logging.info(f'value of path is : {path}')
15
  current_directory = os.getcwd()
16
+ logging.info(f'current dir: {current_directory}')
17
+ logging.info(f'all files: {os.listdir(current_directory)}')
18
  # model_path = "yolov8m_detect_usdl.pt"
19
  # self.model = YOLO(model_path)
20
  # print('Yolo model loaded successfully')
 
22
 
23
  def __call__(self, data: Dict) -> Dict:
24
 
25
+ logging.info(f'Value of data is : {data}')
26
 
27
  # image_url = data.get('image_url')
28
  # print(f'Image url is : {image_url}')
 
34
  # results = self.model(pil_image)
35
  # print(f'TIME Model inference: {time.time() - t1}')
36
  # postprocess the prediction -> results[0].boxes.data.tolist()
37
+ return {"bbox": data}