Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,15 +10,18 @@ def Swap_Face(image1,image2):
|
|
10 |
|
11 |
swapper = insightface.model_zoo.get_model("inswapper_128.onnx", download=False,
|
12 |
download_zip=False)
|
|
|
13 |
|
14 |
# Do the swap
|
15 |
face1 = app.get(image1)[0]
|
16 |
face2 = app.get(image2)[0]
|
17 |
|
18 |
img1_ = image1.copy()
|
19 |
-
|
20 |
|
21 |
-
|
|
|
|
|
22 |
|
23 |
|
24 |
title = "Swap Faces Using Our Model!!!"
|
|
|
10 |
|
11 |
swapper = insightface.model_zoo.get_model("inswapper_128.onnx", download=False,
|
12 |
download_zip=False)
|
13 |
+
face_enhancer = gfpgan.GFPGANer(model_path='GFPGANv1.4.pth', upscale=1)
|
14 |
|
15 |
# Do the swap
|
16 |
face1 = app.get(image1)[0]
|
17 |
face2 = app.get(image2)[0]
|
18 |
|
19 |
img1_ = image1.copy()
|
20 |
+
result = swapper.get(img1_, face1, face2, paste_back=True)
|
21 |
|
22 |
+
_, _, result = face_enhancer.enhance(result,paste_back=True)
|
23 |
+
|
24 |
+
return result
|
25 |
|
26 |
|
27 |
title = "Swap Faces Using Our Model!!!"
|