Spaces:
Runtime error
Runtime error
logs extended
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import insightface
|
3 |
from insightface.app import FaceAnalysis
|
4 |
-
import numpy as np
|
5 |
|
6 |
wellcomingMessage = """
|
7 |
<h1>Face Swapping</h1>
|
@@ -9,9 +8,9 @@ wellcomingMessage = """
|
|
9 |
<p>Happy <span style="font-size:500%;color:red;">♥</span> coding!</p>
|
10 |
"""
|
11 |
|
12 |
-
np.seterr(all="ignore")
|
13 |
assert insightface.__version__>='0.7'
|
14 |
|
|
|
15 |
app = FaceAnalysis(name='buffalo_l')
|
16 |
app.prepare(ctx_id=0, det_size=(640, 640))
|
17 |
swapper = insightface.model_zoo.get_model('inswapper_128.onnx', download=True, download_zip=True)
|
@@ -32,6 +31,9 @@ def swap_faces(faceSource, sourceFaceId, faceDestination, destFaceId):
|
|
32 |
|
33 |
result = swapper.get(faceDestination, res_face, source_face, paste_back=True)
|
34 |
|
|
|
|
|
|
|
35 |
# for face in faces:
|
36 |
# res = swapper.get(res, face, source_face, paste_back=True)
|
37 |
# cv2.imwrite("./t1_swapped.jpg", res)
|
|
|
1 |
import gradio as gr
|
2 |
import insightface
|
3 |
from insightface.app import FaceAnalysis
|
|
|
4 |
|
5 |
wellcomingMessage = """
|
6 |
<h1>Face Swapping</h1>
|
|
|
8 |
<p>Happy <span style="font-size:500%;color:red;">♥</span> coding!</p>
|
9 |
"""
|
10 |
|
|
|
11 |
assert insightface.__version__>='0.7'
|
12 |
|
13 |
+
done = 0
|
14 |
app = FaceAnalysis(name='buffalo_l')
|
15 |
app.prepare(ctx_id=0, det_size=(640, 640))
|
16 |
swapper = insightface.model_zoo.get_model('inswapper_128.onnx', download=True, download_zip=True)
|
|
|
31 |
|
32 |
result = swapper.get(faceDestination, res_face, source_face, paste_back=True)
|
33 |
|
34 |
+
done = done + 1
|
35 |
+
print(f"processed: {done}...")
|
36 |
+
|
37 |
# for face in faces:
|
38 |
# res = swapper.get(res, face, source_face, paste_back=True)
|
39 |
# cv2.imwrite("./t1_swapped.jpg", res)
|