Spaces:
Sleeping

image_ai / utils /image_utils.py
Amjaad
Deploy multi-service FastAPI vision engine
220d6a5
Raw History Blame Contribute Delete
435 Bytes
from PIL import (
Image,
ImageOps
)
def load_image(
image_path
):
return (
ImageOps.exif_transpose(
Image.open(
image_path
)
).convert("RGB")
)
def is_valid_image(
image_path
):
try:
with Image.open(
image_path
) as image:
image.verify()
return True
except Exception:
return False