Spaces:
Runtime error
Runtime error
SerdarHelli
commited on
Commit
•
0fc4a2a
1
Parent(s):
1cdd16d
Update app.py
Browse files
app.py
CHANGED
@@ -54,10 +54,10 @@ def predict(Seed,noise_mode,truncation_psi,trans_x,trans_y,angle):
|
|
54 |
# Construct an inverse rotation/translation matrix and pass to the generator. The
|
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)
|
|
|
54 |
# Construct an inverse rotation/translation matrix and pass to the generator. The
|
55 |
# generator expects this matrix as an inverse to avoid potentially failing numerical
|
56 |
# operations in the network.
|
57 |
+
|
58 |
+
m = make_transform((trans_x,trans_y), angle)
|
59 |
+
m = np.linalg.inv(m)
|
60 |
+
G.synthesis.input.transform.copy_(torch.from_numpy(m))
|
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)
|