Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -114,6 +114,10 @@ async def predict_catdog(file: UploadFile = File(...)):
|
|
| 114 |
try:
|
| 115 |
contents = await file.read()
|
| 116 |
image = Image.open(io.BytesIO(contents))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
_, height, width, _ = cat_dog_model.input_shape
|
| 118 |
img_resized = image.resize((width, height))
|
| 119 |
if img_resized.mode == 'RGBA':
|
|
|
|
| 114 |
try:
|
| 115 |
contents = await file.read()
|
| 116 |
image = Image.open(io.BytesIO(contents))
|
| 117 |
+
|
| 118 |
+
if image.mode != 'RGB':
|
| 119 |
+
image = image.convert('RGB')
|
| 120 |
+
|
| 121 |
_, height, width, _ = cat_dog_model.input_shape
|
| 122 |
img_resized = image.resize((width, height))
|
| 123 |
if img_resized.mode == 'RGBA':
|