Commit
·
e7df148
1
Parent(s):
0fc4a2a
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,9 +55,10 @@ def predict(Seed,noise_mode,truncation_psi,trans_x,trans_y,angle):
|
|
| 55 |
# generator expects this matrix as an inverse to avoid potentially failing numerical
|
| 56 |
# operations in the network.
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
| 61 |
|
| 62 |
img = G(z, label, truncation_psi=truncation_psi, noise_mode=noise_mode)
|
| 63 |
img = (img.permute(0, 2, 3, 1) * 127.5 + 128).clamp(0, 255).to(torch.uint8)
|
|
|
|
| 55 |
# generator expects this matrix as an inverse to avoid potentially failing numerical
|
| 56 |
# operations in the network.
|
| 57 |
|
| 58 |
+
if hasattr(G.synthesis, 'input'):
|
| 59 |
+
m = make_transform((trans_x,trans_y), angle)
|
| 60 |
+
m = np.linalg.inv(m)
|
| 61 |
+
G.synthesis.input.transform.copy_(torch.from_numpy(m))
|
| 62 |
|
| 63 |
img = G(z, label, truncation_psi=truncation_psi, noise_mode=noise_mode)
|
| 64 |
img = (img.permute(0, 2, 3, 1) * 127.5 + 128).clamp(0, 255).to(torch.uint8)
|