felixrosberg commited on
Commit
057a565
β€’
1 Parent(s): 4021817

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -99,8 +99,10 @@ def run_inference(target, source, slider, settings):
99
  np.random.shuffle(anon_vector)
100
  source_z *= anon_vector"""
101
 
102
- source_z = ArcFace.predict(np.expand_dims(tf.image.resize(im_aligned, [112, 112]) / 255.0, axis=0))
103
- source_z = IDP.predict(source_z)
 
 
104
 
105
  # face swap
106
  changed_face_cage = G.predict([np.expand_dims((im_aligned - 127.5) / 127.5, axis=0),
@@ -135,12 +137,12 @@ def run_inference(target, source, slider, settings):
135
  description = "Performs subject agnostic identity transfer from a source face to all target faces. \n\n" \
136
  "Options:\n" \
137
  "compare returns the target image concatenated with the results.\n" \
138
- "anonymize will ignore the source image and perform an identity permutation of target faces.\n" \
 
139
  "\n" \
140
  "Note, source image with too high resolution may not work properly!"
141
  examples = [["assets/rick.jpg", "assets/musk.jpg", 80, ["compare"]],
142
- ["assets/girl_1.png", "assets/girl_0.png", 80, []],
143
- ["assets/musk.jpg", "assets/musk.jpg", 30, ["anonymize"]]]
144
  article="""
145
  Demo is based of recent research from my Ph.D work. Results expects to be published in the coming months.
146
  """
 
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 = slider * source_z + (1 - slider) * target_z
106
 
107
  # face swap
108
  changed_face_cage = G.predict([np.expand_dims((im_aligned - 127.5) / 127.5, axis=0),
 
137
  description = "Performs subject agnostic identity transfer from a source face to all target faces. \n\n" \
138
  "Options:\n" \
139
  "compare returns the target image concatenated with the results.\n" \
140
+ "anonymize will ignore the source image and perform an identity permutation of target faces."
141
+ "NOTE: There is no guarantees with the anonymization process currently.\n" \
142
  "\n" \
143
  "Note, source image with too high resolution may not work properly!"
144
  examples = [["assets/rick.jpg", "assets/musk.jpg", 80, ["compare"]],
145
+ ["assets/musk.jpg", "assets/musk.jpg", 80, ["anonymize"]]]
 
146
  article="""
147
  Demo is based of recent research from my Ph.D work. Results expects to be published in the coming months.
148
  """