Resolve absolute model path
This commit is contained in:
parent
47dafb48ba
commit
ffc2bd2485
@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
import cv2
|
||||
import insightface
|
||||
from core.config import get_face
|
||||
@ -9,7 +11,8 @@ FACE_SWAPPER = None
|
||||
def get_face_swapper():
|
||||
global FACE_SWAPPER
|
||||
if FACE_SWAPPER is None:
|
||||
FACE_SWAPPER = insightface.model_zoo.get_model('inswapper_128.onnx')
|
||||
model_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'inswapper_128.onnx')
|
||||
FACE_SWAPPER = insightface.model_zoo.get_model(model_path)
|
||||
return FACE_SWAPPER
|
||||
|
||||
|
||||
|
3
run.py
3
run.py
@ -64,7 +64,8 @@ def pre_check():
|
||||
quit(f'Python version is not supported - please upgrade to 3.8 or higher')
|
||||
if not shutil.which('ffmpeg'):
|
||||
quit('ffmpeg is not installed!')
|
||||
if os.path.isfile('../inswapper_128.onnx'):
|
||||
model_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'inswapper_128.onnx')
|
||||
if not os.path.isfile(model_path):
|
||||
quit('File "inswapper_128.onnx" does not exist!')
|
||||
if '--gpu' in sys.argv:
|
||||
CUDA_VERSION = torch.version.cuda
|
||||
|
Loading…
Reference in New Issue
Block a user