refactor try block

This commit is contained in:
haddyadnan 2023-10-19 12:55:58 -07:00
parent cca3422b54
commit 1bcc065a11

View File

@ -8,9 +8,9 @@ def build_model():
# Optional dependency
try:
from facenet_pytorch import MTCNN as fast_mtcnn
except ModuleNotFoundError:
print("This is an optional detector, ensure the library is installed. \
Please install using 'pip install facenet-pytorch' ")
except ModuleNotFoundError as e:
raise ImportError("This is an optional detector, ensure the library is installed. \
Please install using 'pip install facenet-pytorch' ") from e
face_detector = fast_mtcnn(image_size=160,