Emotion-detect / utils.py
ShamsKhan404's picture
Update utils.py
d5b9cd0 verified
raw
history blame
268 Bytes
import tensorflow as tf
import numpy as np
from PIL import Image
def preprocess_image(image_file):
img = Image.open(image_file).convert("RGB")
img = img.resize((256, 256))
img = np.array(img) / 255.0
img = np.expand_dims(img, axis=0)
return img