diff --git a/invokeai/app/invocations/facetools.py b/invokeai/app/invocations/facetools.py index c64a842dbb..f02e4d476a 100644 --- a/invokeai/app/invocations/facetools.py +++ b/invokeai/app/invocations/facetools.py @@ -1,5 +1,7 @@ import math +import os import re +from pathlib import Path from typing import Optional, TypedDict import cv2 @@ -75,8 +77,6 @@ def create_black_image(w: int, h: int) -> ImageType: FONT_SIZE = 32 FONT_STROKE_WIDTH = 4 -font = ImageFont.truetype("invokeai/assets/fonts/inter/Inter-Regular.ttf", FONT_SIZE) - def prepare_faces_list( face_result_list: list[FaceResultData], @@ -641,6 +641,10 @@ class FaceIdentifierInvocation(BaseInvocation): draw_mesh=False, ) + path = Path(__file__).resolve().parent.parent.parent + font_path = os.path.abspath(path / "assets/fonts/inter/Inter-Regular.ttf") + font = ImageFont.truetype(font_path, FONT_SIZE) + # Paste face IDs on the output image draw = ImageDraw.Draw(image) for face in all_faces: