Update image_utils.py

The binary mode of fromstring is deprecated: corrected to frombuffer.
This commit is contained in:
SachaDee 2024-10-26 23:09:55 -03:00 committed by GitHub
parent 29eac19836
commit 8d68c6e739
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -127,7 +127,7 @@ def load_image_from_base64(uri: str) -> np.ndarray:
if file_type not in {"jpeg", "png"}:
raise ValueError(f"Input image can be jpg or png, but it is {file_type}")
nparr = np.fromstring(decoded_bytes, np.uint8)
nparr = np.frombuffer(decoded_bytes, np.uint8)
img_bgr = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
# img_rgb = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB)
return img_bgr