mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fix absolute path for font file
Make the font file relative to this source file. Not ideal, but it will work no matter where InvokeAI is launched.
This commit is contained in:
parent
08e40d6d16
commit
27164de8b8
@ -1,5 +1,7 @@
|
|||||||
import math
|
import math
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
from pathlib import Path
|
||||||
from typing import Optional, TypedDict
|
from typing import Optional, TypedDict
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
@ -75,8 +77,6 @@ def create_black_image(w: int, h: int) -> ImageType:
|
|||||||
FONT_SIZE = 32
|
FONT_SIZE = 32
|
||||||
FONT_STROKE_WIDTH = 4
|
FONT_STROKE_WIDTH = 4
|
||||||
|
|
||||||
font = ImageFont.truetype("invokeai/assets/fonts/inter/Inter-Regular.ttf", FONT_SIZE)
|
|
||||||
|
|
||||||
|
|
||||||
def prepare_faces_list(
|
def prepare_faces_list(
|
||||||
face_result_list: list[FaceResultData],
|
face_result_list: list[FaceResultData],
|
||||||
@ -641,6 +641,10 @@ class FaceIdentifierInvocation(BaseInvocation):
|
|||||||
draw_mesh=False,
|
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
|
# Paste face IDs on the output image
|
||||||
draw = ImageDraw.Draw(image)
|
draw = ImageDraw.Draw(image)
|
||||||
for face in all_faces:
|
for face in all_faces:
|
||||||
|
Loading…
Reference in New Issue
Block a user