pneumo-api / utils /image_preprocessing.py
BIRADAR VILOHITH PATIL
Deploy backend with LFS for model
bbed6ca
Raw
History Blame Contribute Delete
244 Bytes
from PIL import Image
import numpy as np
def preprocess_image(image_path: str):
img = Image.open(image_path).convert("RGB")
img = img.resize((224, 224))
img_array = np.array(img) / 255.0
return np.expand_dims(img_array, axis=0)