jbilcke commited on
Commit
1a40fcc
โ€ข
1 Parent(s): d2a6fce

fix for the

Browse files

'could not broadcast input array from shape (512,512,4) into shape (512,512,3)' error

Files changed (1) hide show
  1. engine.py +4 -0
engine.py CHANGED
@@ -65,6 +65,10 @@ class Engine:
65
  @alru_cache(maxsize=512)
66
  async def load_image(self, data):
67
  image = Image.open(io.BytesIO(data))
 
 
 
 
68
  uid = str(uuid.uuid4())
69
  img_rgb = np.array(image)
70
 
 
65
  @alru_cache(maxsize=512)
66
  async def load_image(self, data):
67
  image = Image.open(io.BytesIO(data))
68
+
69
+ # Convert the image to RGB mode (removes alpha channel if present)
70
+ image = image.convert('RGB')
71
+
72
  uid = str(uuid.uuid4())
73
  img_rgb = np.array(image)
74