Commit
Β·
bf45329
1
Parent(s):
cff9a9f
Update app.py
Browse files
app.py
CHANGED
|
@@ -99,10 +99,12 @@ def run_inference(target, source, slider, settings):
|
|
| 99 |
np.random.shuffle(anon_vector)
|
| 100 |
source_z *= anon_vector"""
|
| 101 |
|
|
|
|
|
|
|
| 102 |
target_z = ArcFace.predict(np.expand_dims(tf.image.resize(im_aligned, [112, 112]) / 255.0, axis=0))
|
| 103 |
source_z = IDP.predict(target_z)
|
| 104 |
|
| 105 |
-
source_z =
|
| 106 |
|
| 107 |
# face swap
|
| 108 |
changed_face_cage = G.predict([np.expand_dims((im_aligned - 127.5) / 127.5, axis=0),
|
|
|
|
| 99 |
np.random.shuffle(anon_vector)
|
| 100 |
source_z *= anon_vector"""
|
| 101 |
|
| 102 |
+
slider_weight = slider / 100
|
| 103 |
+
|
| 104 |
target_z = ArcFace.predict(np.expand_dims(tf.image.resize(im_aligned, [112, 112]) / 255.0, axis=0))
|
| 105 |
source_z = IDP.predict(target_z)
|
| 106 |
|
| 107 |
+
source_z = slider_weight * source_z + (1 - slider_weight ) * target_z
|
| 108 |
|
| 109 |
# face swap
|
| 110 |
changed_face_cage = G.predict([np.expand_dims((im_aligned - 127.5) / 127.5, axis=0),
|