Spaces:
Running
on
L40S
Running
on
L40S
fix for the
Browse files'could not broadcast input array from shape (512,512,4) into shape (512,512,3)' error
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 |
|