Face rec: only consider webp files in /faces and handle_request (#17244)

* Face rec: only consider webp files

* Allow png/jpg/jpeg as well as webp
This commit is contained in:
leccelecce 2025-03-19 12:44:07 +00:00 committed by GitHub
parent ac9e24e2ed
commit dda7be99eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -39,7 +39,10 @@ def get_faces():
face_dict[name] = []
for file in sorted(
os.listdir(face_dir),
filter(
lambda f: (f.lower().endswith((".webp", ".png", ".jpg", ".jpeg"))),
os.listdir(face_dir),
),
key=lambda f: os.path.getctime(os.path.join(face_dir, f)),
reverse=True,
):

View File

@ -484,7 +484,7 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
shutil.move(current_file, new_file)
files = sorted(
os.listdir(folder),
filter(lambda f: (f.endswith(".webp")), os.listdir(folder)),
key=lambda f: os.path.getctime(os.path.join(folder, f)),
reverse=True,
)