solve the FACE_ENHANCER os problem for non-nt(linux, mac) system

pull/74/head
c4fun 2024-08-07 23:26:47 +08:00
parent fc9bd973f0
commit 6400a80a91
1 changed files with 6 additions and 2 deletions

View File

@ -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