From 4bf676176298864f752333d3a5ee5ff36b7e3f1f Mon Sep 17 00:00:00 2001 From: thongao1302 Date: Mon, 12 Aug 2024 13:32:32 +0700 Subject: [PATCH] Merge pull request #74 from c4fun/main solve the FACE_ENHANCER os problem for non-nt(linux, mac) system --- modules/processors/frame/face_enhancer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/processors/frame/face_enhancer.py b/modules/processors/frame/face_enhancer.py index 4d960af..608071a 100644 --- a/modules/processors/frame/face_enhancer.py +++ b/modules/processors/frame/face_enhancer.py @@ -2,6 +2,7 @@ from typing import Any, List import cv2 import threading import gfpgan +import os import modules.globals import modules.processors.frame.core @@ -34,8 +35,11 @@ def get_face_enhancer() -> Any: with THREAD_LOCK: if FACE_ENHANCER is None: - model_path = resolve_relative_path('..\models\GFPGANv1.4.pth') - # todo: set models path https://github.com/TencentARC/GFPGAN/issues/399 + if os.name == 'nt': + model_path = resolve_relative_path('..\models\GFPGANv1.4.pth') + # todo: set models path https://github.com/TencentARC/GFPGAN/issues/399 + else: + model_path = resolve_relative_path('../models/GFPGANv1.4.pth') FACE_ENHANCER = gfpgan.GFPGANer(model_path=model_path, upscale=1) # type: ignore[attr-defined] return FACE_ENHANCER