Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -68,11 +68,11 @@ def generate_grid():
|
|
| 68 |
args = cfg.parse_args()
|
| 69 |
|
| 70 |
with torch.no_grad():
|
| 71 |
-
|
| 72 |
-
z = torch.
|
| 73 |
imgs = G(z) # (B,3,H,W) in [-1,1] or [0,1]
|
| 74 |
|
| 75 |
-
# make a
|
| 76 |
grid = make_grid(imgs, nrow=N_COLS, normalize=True, scale_each=True)
|
| 77 |
return _to_pil_grid(grid)
|
| 78 |
|
|
|
|
| 68 |
args = cfg.parse_args()
|
| 69 |
|
| 70 |
with torch.no_grad():
|
| 71 |
+
z_np = truncnorm.rvs(-1, 1, loc=0, scale=1, size=(N_SAMPLES, latent_dim)).astype(np.float32)
|
| 72 |
+
z = torch.from_numpy(z_np).to(device)
|
| 73 |
imgs = G(z) # (B,3,H,W) in [-1,1] or [0,1]
|
| 74 |
|
| 75 |
+
# make a grid; normalize handles [-1,1]
|
| 76 |
grid = make_grid(imgs, nrow=N_COLS, normalize=True, scale_each=True)
|
| 77 |
return _to_pil_grid(grid)
|
| 78 |
|