From 8daefd4f51ce5246a3bec7c6f41aecd49aba22a7 Mon Sep 17 00:00:00 2001 From: narugo1992 <117186571+narugo1992@users.noreply.github.com> Date: Sat, 1 Jun 2024 17:23:38 +0800 Subject: [PATCH] dev(narugo): fix c, ci skip --- skpick/check/hqimage.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/skpick/check/hqimage.py b/skpick/check/hqimage.py index 7c4d56f..73c9b0c 100644 --- a/skpick/check/hqimage.py +++ b/skpick/check/hqimage.py @@ -21,14 +21,17 @@ def is_hqimage(file, face_threshold: int = 5000): return True image = load_image(image) - if anime_real(image)[0] != 'anime': - return False - if anime_classify(image)[0] != 'illustration': + try: + if anime_real(image)[0] != 'anime': + return False + if anime_classify(image)[0] != 'illustration': + return False + + for (x0, y0, x1, y1), _, _ in detect_faces(image): + area = abs((x1 - x0) * (y1 - y0)) + if area >= face_threshold: + return True + except OSError: return False - for (x0, y0, x1, y1), _, _ in detect_faces(image): - area = abs((x1 - x0) * (y1 - y0)) - if area >= face_threshold: - return True - return False