OpenCv Не удается преобразовать объект типа 'JpegImageFile' в 'str' для 'filename'
from PIL import Image
import numpy as np
def save(self, *args, **kwargs):
# open image
pil_img = Image.open(self.pic)
# convert the image to array and do some processing
cv_img = np.array(pil_img)
img = main(pil_img)
# convert back to pil image
im_pil = Image.fromarray(img)
# save
buffer = BytesIO()
im_pil.save(buffer, format='png')
image_png = buffer.getvalue()
self.pic.save(str(self.pic), ContentFile(image_png), save=False)
super().save(*args, **kwargs)
не могу понять, что с ним не так. Я даже пытался закомментировать cv_img = np.array(pil_img), но он все равно не запускается