Closed DumbBoy10 closed 2 weeks ago
@DumbBoy10 can you do a pickle.dump of the bytearray you are passing to the detect function and post here? I will check and add support if needed.
Sorry for inconvenience I just resolved it with pillow and this lines of code. Thanks for you answering.
image = self.cleaned_data.get('image')
# Convert Django UploadedFile to PIL Image
pil_image = PilImage.open(image)
# Save PIL Image to an in-memory bytes buffer
img_byte_arr = io.BytesIO()
pil_image.save(img_byte_arr, format=pil_image.format)
img_byte_arr = img_byte_arr.getvalue()
# Assuming NudeDetector can work with bytes, pass the bytes directly
detector = NudeDetector()
# If NudeDetector requires a file-like object, use io.BytesIO(img_byte_arr) instead of img_byte_arr
test = detector.detect(img_byte_arr)
How do I parse an img byte array into the detect function.
I have an image from form and I want to check that image before I save it. How do I achieve that.
I all ways end with this error: 'ValueError: please make sure the image_path is str or np.ndarray or bytes'