from PIL import Image import io def load_image(image_file): """Load an image file and return a PIL Image object.""" img = Image.open(image_file) return img.convert("RGB")