Update handler.py
Browse files- handler.py +5 -2
handler.py
CHANGED
@@ -70,10 +70,13 @@ class EndpointHandler:
|
|
70 |
else:
|
71 |
x1, y1, x2, y2 = int(detections.xyxy[0][0]), int(detections.xyxy[0][1]), int(detections.xyxy[0][2]), int(detections.xyxy[0][3])
|
72 |
clothes = img[y1: y2, x1: x2]
|
|
|
73 |
retval , buffer = cv2.imencode('.jpg', clothes)
|
74 |
-
|
|
|
|
|
75 |
# create base 64 object
|
76 |
-
jpg_as_text = base64.b64encode(
|
77 |
# base64_encoded = base64.b64encode(image_bytes).decode("utf-8")
|
78 |
|
79 |
# Get the image format
|
|
|
70 |
else:
|
71 |
x1, y1, x2, y2 = int(detections.xyxy[0][0]), int(detections.xyxy[0][1]), int(detections.xyxy[0][2]), int(detections.xyxy[0][3])
|
72 |
clothes = img[y1: y2, x1: x2]
|
73 |
+
clothes = cv2.cvtColor(clothes, cv2.COLOR_BGR2RGB)
|
74 |
retval , buffer = cv2.imencode('.jpg', clothes)
|
75 |
+
im_bytes = buffer.tobytes()
|
76 |
+
|
77 |
+
# cv2.imwrite("result.jpg", clothes)
|
78 |
# create base 64 object
|
79 |
+
jpg_as_text = base64.b64encode(im_bytes).decode("utf-8") # Decode bytes to string")
|
80 |
# base64_encoded = base64.b64encode(image_bytes).decode("utf-8")
|
81 |
|
82 |
# Get the image format
|