SerdarHelli commited on
Commit
e7df148
1 Parent(s): 0fc4a2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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
- 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)
 
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)