-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
- Loading branch information
1 parent
355adf8
commit a0e6ded
Showing
1 changed file
with
8 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |