Undo: Resolve absolute model path

This commit is contained in:
henryruhs 2023-05-30 21:47:59 +02:00
parent f50337f708
commit 98a5111d53
2 changed files with 2 additions and 4 deletions

View File

@ -11,8 +11,7 @@ FACE_SWAPPER = None
def get_face_swapper(): def get_face_swapper():
global FACE_SWAPPER global FACE_SWAPPER
if FACE_SWAPPER is None: if FACE_SWAPPER is None:
model_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'inswapper_128.onnx') FACE_SWAPPER = insightface.model_zoo.get_model('inswapper_128.onnx')
FACE_SWAPPER = insightface.model_zoo.get_model(model_path)
return FACE_SWAPPER return FACE_SWAPPER

3
run.py
View File

@ -61,8 +61,7 @@ def pre_check():
quit(f'Python version is not supported - please upgrade to 3.8 or higher') quit(f'Python version is not supported - please upgrade to 3.8 or higher')
if not shutil.which('ffmpeg'): if not shutil.which('ffmpeg'):
quit('ffmpeg is not installed!') quit('ffmpeg is not installed!')
model_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'inswapper_128.onnx') if not os.path.isfile('inswapper_128.onnx'):
if not os.path.isfile(model_path):
quit('File "inswapper_128.onnx" does not exist!') quit('File "inswapper_128.onnx" does not exist!')
if '--gpu' in sys.argv: if '--gpu' in sys.argv:
CUDA_VERSION = torch.version.cuda CUDA_VERSION = torch.version.cuda