Omarelrayes commited on
Commit
82dbc73
·
verified ·
1 Parent(s): f9781d4

Upload 3 files

Browse files
app/core/preprocessing.py CHANGED
@@ -6,4 +6,4 @@ def preprocess_image(image_bytes: bytes, target_size=(224, 224)) -> np.ndarray:
6
  image = Image.open(io.BytesIO(image_bytes)).convert("RGB")
7
  image = image.resize(target_size)
8
  img_array = np.array(image, dtype=np.float32) / 255.0
9
- return np.expand_dims(img_array, axis=0)
 
6
  image = Image.open(io.BytesIO(image_bytes)).convert("RGB")
7
  image = image.resize(target_size)
8
  img_array = np.array(image, dtype=np.float32) / 255.0
9
+ return np.expand_dims(img_array, axis=0)
app/core/validation.py CHANGED
@@ -6,4 +6,4 @@ def is_valid_image(file_bytes: bytes) -> bool:
6
  Image.open(io.BytesIO(file_bytes)).verify()
7
  return True
8
  except:
9
- return False
 
6
  Image.open(io.BytesIO(file_bytes)).verify()
7
  return True
8
  except:
9
+ return False