From a0e6dedff23b301f42f0b517764b48494be2b936 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:34:07 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- detect_faces.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/detect_faces.py b/detect_faces.py index 4789ac1..bfb7fa0 100644 --- a/detect_faces.py +++ b/detect_faces.py @@ -1,19 +1,23 @@ import os + from PIL import Image + def detect_faces(image_path): """Detect faces in the given image path.""" # Validate input if not os.path.exists(image_path): raise FileNotFoundError(f"The file {image_path} does not exist.") - if not image_path.lower().endswith(('.png', '.jpg', '.jpeg')): - raise ValueError("Unsupported image format. Please use .png, .jpg, or .jpeg files.") - + if not image_path.lower().endswith((".png", ".jpg", ".jpeg")): + raise ValueError( + "Unsupported image format. Please use .png, .jpg, or .jpeg files." + ) + try: image = Image.open(image_path) except IOError: raise ValueError("The image file is corrupted or cannot be opened.") - + # Face detection logic here... faces = [] # Replace with actual face detection logic return faces