From 0e7e7698fecefcb2366b7382e4b471606c8c5b26 Mon Sep 17 00:00:00 2001 From: Bosco Yung <15840328+bhky@users.noreply.github.com> Date: Sun, 18 Aug 2024 08:26:58 +0900 Subject: [PATCH] Add extra type assertion for mypy --- opennsfw2/_inference.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opennsfw2/_inference.py b/opennsfw2/_inference.py index 97cdb9b..1e1652d 100644 --- a/opennsfw2/_inference.py +++ b/opennsfw2/_inference.py @@ -108,6 +108,7 @@ def predict_images( from ._inspection import make_and_save_nsfw_grad_cam for image_handle, grad_cam_path in zip(image_handles, grad_cam_paths): + assert isinstance(image_handle, (str, Image.Image)) # For mypy. pil_image = _load_pil_image(image_handle) make_and_save_nsfw_grad_cam( pil_image, preprocessing, global_model, grad_cam_path, alpha