inference result sending fix
exception handling when there is no mask
@38444928944ba2432dfbc34a9f4e89e44bc50f2c
--- inference_endpoint.py
+++ inference_endpoint.py
... | ... | @@ -61,6 +61,7 @@ |
61 | 61 |
self.seg_image = None |
62 | 62 |
self.area_percent = 0 |
63 | 63 |
self.time_zone = self.time_zone = ZoneInfo("Asia/Seoul") |
64 |
+ self.endpoint = None |
|
64 | 65 |
|
65 | 66 |
@ns.response(200, 'Success') |
66 | 67 |
@ns.response(400, 'Validation Error') |
... | ... | @@ -113,13 +114,14 @@ |
113 | 114 |
'x-area-percentage' : str(self.area_percent), |
114 | 115 |
} |
115 | 116 |
session = requests.Session() |
116 |
- seg_binary = cv2.imencode('.png', self.seg_image) |
|
117 |
- seg_binary = seg_binary[1].tobytes() |
|
117 |
+ |
|
118 | 118 |
print(type(self.seg_image)) |
119 | 119 |
print(type(self.mask)) |
120 | 120 |
print(type(self.image)) |
121 | 121 |
try: |
122 | 122 |
if len(self.mask) != 0: |
123 |
+ seg_binary = cv2.imencode('.png', self.seg_image) |
|
124 |
+ seg_binary = seg_binary[1].tobytes() |
|
123 | 125 |
multipart_data = MultipartEncoder( |
124 | 126 |
fields={ |
125 | 127 |
'image': ( |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?