handle when user has gpu but won't use it

This commit is contained in:
Somdev Sangwan 2023-05-29 19:04:00 +05:30
parent d72d9d7328
commit fa813d8025
3 changed files with 11 additions and 2 deletions

View File

@ -1,7 +1,8 @@
import insightface
import onnxruntime
import core.globals
face_analyser = insightface.app.FaceAnalysis(name='buffalo_l', providers=onnxruntime.get_available_providers())
face_analyser = insightface.app.FaceAnalysis(name='buffalo_l', providers=core.globals.providers)
face_analyser.prepare(ctx_id=0, det_size=(640, 640))

View File

@ -1,10 +1,11 @@
import cv2
import insightface
import onnxruntime
import core.globals
from core.config import get_face
from core.utils import rreplace
face_swapper = insightface.model_zoo.get_model('inswapper_128.onnx', providers=onnxruntime.get_available_providers())
face_swapper = insightface.model_zoo.get_model('inswapper_128.onnx', providers=core.globals.providers)
def process_video(source_img, frame_paths):

7
run.py
View File

@ -1,3 +1,10 @@
import sys
import onnxruntime
import core.globals
if '--gpu' in sys.argv:
core.globals.providers = onnxruntime.get_available_providers()
import glob
import argparse
import multiprocessing as mp