윤영준 윤영준 05-23
inference result sending fix
exception handling when there is no mask
@38444928944ba2432dfbc34a9f4e89e44bc50f2c
inference_endpoint.py
--- inference_endpoint.py
+++ inference_endpoint.py
@@ -61,6 +61,7 @@
         self.seg_image = None
         self.area_percent = 0
         self.time_zone = self.time_zone = ZoneInfo("Asia/Seoul")
+        self.endpoint = None
 
     @ns.response(200, 'Success')
     @ns.response(400, 'Validation Error')
@@ -113,13 +114,14 @@
             'x-area-percentage' : str(self.area_percent),
         }
         session = requests.Session()
-        seg_binary = cv2.imencode('.png', self.seg_image)
-        seg_binary = seg_binary[1].tobytes()
+
         print(type(self.seg_image))
         print(type(self.mask))
         print(type(self.image))
         try:
             if len(self.mask) != 0:
+                seg_binary = cv2.imencode('.png', self.seg_image)
+                seg_binary = seg_binary[1].tobytes()
                 multipart_data = MultipartEncoder(
                     fields={
                         'image': (
Add a comment
List