Update handler.py
Browse files69 unmodified lines7071727374757677787969 unmodified lineselse:x1, y1, x2, y2 = int(detections.xyxy[0][0]), int(detections.xyxy[0][1]), int(detections.xyxy[0][2]), int(detections.xyxy[0][3])clothes = img[y1: y2, x1: x2]retval , buffer = cv2.imencode('.jpg', clothes)cv2.imwrite("result.jpg", clothes)# create base 64 objectjpg_as_text = base64.b64encode(buffer) # Decode bytes to string")# base64_encoded = base64.b64encode(image_bytes).decode("utf-8")# Get the image format69 unmodified lines7071727374757677787980818269 unmodified lineselse:x1, y1, x2, y2 = int(detections.xyxy[0][0]), int(detections.xyxy[0][1]), int(detections.xyxy[0][2]), int(detections.xyxy[0][3])clothes = img[y1: y2, x1: x2]clothes = cv2.cvtColor(clothes, cv2.COLOR_BGR2RGB)retval , buffer = cv2.imencode('.jpg', clothes)im_bytes = buffer.tobytes()# cv2.imwrite("result.jpg", clothes)# create base 64 objectjpg_as_text = base64.b64encode(im_bytes).decode("utf-8") # Decode bytes to string")# base64_encoded = base64.b64encode(image_bytes).decode("utf-8")# Get the image format
handler.py+5-2