muhalwan commited on
Commit
3681241
·
verified ·
1 Parent(s): 4d15c05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
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':