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