MissingBreath commited on
Commit
eabc720
·
verified ·
1 Parent(s): 89f7e1b

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +2 -0
api.py CHANGED
@@ -98,6 +98,7 @@ def predict(image):
98
  async def ipredict(image: UploadFile = File(...)):
99
  if image is not None:
100
  img = Image.open(io.BytesIO(await image.read()))
 
101
  # img = img.resize((128, 128))
102
  # img_array = np.array(img) / 255.0
103
  # Get the prediction
@@ -112,6 +113,7 @@ async def ipredict(image: UploadFile = File(...)):
112
  async def vpredict(image: UploadFile = File(...)):
113
  if image is not None:
114
  img = Image.open(io.BytesIO(await image.read()))
 
115
  # img = img.resize((128, 128))
116
  # img_array = np.array(img) / 255.0
117
  # Get the prediction
 
98
  async def ipredict(image: UploadFile = File(...)):
99
  if image is not None:
100
  img = Image.open(io.BytesIO(await image.read()))
101
+ img = cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)
102
  # img = img.resize((128, 128))
103
  # img_array = np.array(img) / 255.0
104
  # Get the prediction
 
113
  async def vpredict(image: UploadFile = File(...)):
114
  if image is not None:
115
  img = Image.open(io.BytesIO(await image.read()))
116
+ img = cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)
117
  # img = img.resize((128, 128))
118
  # img_array = np.array(img) / 255.0
119
  # Get the prediction