profaker commited on
Commit
ac1d771
1 Parent(s): 6715af7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -7,12 +7,13 @@ import onnxruntime
7
 
8
 
9
  def Swap_Face(image1,image2):
10
- app = FaceAnalysis(name='buffalo_l')
 
11
  app.prepare(ctx_id=0, det_size=(640, 640))
12
-
13
  swapper = insightface.model_zoo.get_model("inswapper_128.onnx", download=False,
14
- download_zip=False,providers=['CUDAExecutionProvider'])
15
- face_enhancer = GFPGANer(model_path="GFPGANv1.4.pth", upscale=1,device="cuda")
16
 
17
  # Do the swap
18
  face1 = app.get(image1)[0]
 
7
 
8
 
9
  def Swap_Face(image1,image2):
10
+ providers = onnxruntime.get_available_providers()
11
+ app = FaceAnalysis(name='buffalo_l',providers=providers)
12
  app.prepare(ctx_id=0, det_size=(640, 640))
13
+
14
  swapper = insightface.model_zoo.get_model("inswapper_128.onnx", download=False,
15
+ download_zip=False,providers=providers)
16
+ face_enhancer = GFPGANer(model_path="GFPGANv1.4.pth", upscale=1)
17
 
18
  # Do the swap
19
  face1 = app.get(image1)[0]