MarioPrzBasto commited on
Commit
ebb0ee4
·
verified ·
1 Parent(s): 506344e

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -90,9 +90,9 @@ def load_image_url(source):
90
  img = np.asarray(bytearray(response.content), dtype=np.uint8)
91
  img = cv2.imdecode(img, cv2.IMREAD_GRAYSCALE)
92
  else:
93
- img = base64.b64decode(source)
94
- img = Image.open(BytesIO(img))
95
- img = np.array(img)
96
  img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
97
 
98
  return img
 
90
  img = np.asarray(bytearray(response.content), dtype=np.uint8)
91
  img = cv2.imdecode(img, cv2.IMREAD_GRAYSCALE)
92
  else:
93
+ img_data = base64.b64decode(source)
94
+ image = Image.open(BytesIO(img_data)).convert("RGB")
95
+ img = np.array(image).astype(np.uint8)
96
  img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
97
 
98
  return img