update indent
Browse files
app.py
CHANGED
@@ -167,14 +167,14 @@ def inference(num_of_image,seed,trunc_psi,eyebrows,eyesize,gaze_direction,nose_l
|
|
167 |
|
168 |
new_codes = latent_wp.copy()
|
169 |
for attr_name in ATTRS:
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
new_codes = torch.from_numpy(new_codes.astype(np.float32)).cpu()
|
179 |
with torch.no_grad():
|
180 |
images_mani = generator.synthesis(new_codes)['image']
|
|
|
167 |
|
168 |
new_codes = latent_wp.copy()
|
169 |
for attr_name in ATTRS:
|
170 |
+
if attr_name in ['eyebrows', 'lipstick']:
|
171 |
+
layers_idx = [8,9,10,11]
|
172 |
+
else:
|
173 |
+
layers_idx = [4,5,6,7]
|
174 |
+
step = eval(attr_name)
|
175 |
+
direction = boundaries[attr_name]
|
176 |
+
direction = np.tile(direction, [1, generator.num_layers, 1])
|
177 |
+
new_codes[:, layers_idx, :] += direction[:, layers_idx, :] * step
|
178 |
new_codes = torch.from_numpy(new_codes.astype(np.float32)).cpu()
|
179 |
with torch.no_grad():
|
180 |
images_mani = generator.synthesis(new_codes)['image']
|