profaker commited on
Commit
5cca128
1 Parent(s): ad06a10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -2,7 +2,7 @@
2
  import insightface
3
  from insightface.app import FaceAnalysis
4
  import gradio as gr
5
- #import gfpgan
6
  import onnxruntime
7
 
8
 
@@ -12,7 +12,7 @@ def Swap_Face(image1,image2):
12
 
13
  swapper = insightface.model_zoo.get_model("inswapper_128.onnx", download=False,
14
  download_zip=False,providers=onnxruntime.get_available_providers())
15
- #face_enhancer = gfpgan.GFPGANer(model_path="GFPGANv1.4.pth", upscale=1)
16
 
17
  # Do the swap
18
  face1 = app.get(image1)[0]
@@ -20,9 +20,8 @@ def Swap_Face(image1,image2):
20
 
21
  img1_ = image1.copy()
22
  result = swapper.get(img1_, face1, face2, paste_back=True)
23
-
24
 
25
-
26
  return result
27
 
28
 
 
2
  import insightface
3
  from insightface.app import FaceAnalysis
4
  import gradio as gr
5
+ from gfpgan import GFPGANer
6
  import onnxruntime
7
 
8
 
 
12
 
13
  swapper = insightface.model_zoo.get_model("inswapper_128.onnx", download=False,
14
  download_zip=False,providers=onnxruntime.get_available_providers())
15
+ face_enhancer = GFPGANer(model_path="GFPGANv1.4.pth", upscale=1)
16
 
17
  # Do the swap
18
  face1 = app.get(image1)[0]
 
20
 
21
  img1_ = image1.copy()
22
  result = swapper.get(img1_, face1, face2, paste_back=True)
23
+ _, _, result = face_enhancer.enhance(result)
24
 
 
25
  return result
26
 
27