Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ pretransform = transforms.Compose([
|
|
| 19 |
def pipeline(img):
|
| 20 |
img = model_build.img_preprocess(img, pretransform)
|
| 21 |
with torch.no_grad():
|
| 22 |
-
|
| 23 |
img = stylegan2(latent_space, noise_mode='none')
|
| 24 |
img = Image.fromarray(np.array((img.permute(0, 2, 3, 1) * 127.5 + 128).clamp(0, 255).to(torch.uint8).squeeze(0)[20:-20,:,:]))
|
| 25 |
img.save('output.png')
|
|
|
|
| 19 |
def pipeline(img):
|
| 20 |
img = model_build.img_preprocess(img, pretransform)
|
| 21 |
with torch.no_grad():
|
| 22 |
+
latent_space = psp(img.float(), randomize_noise=True, resize=False, return_latents=True)
|
| 23 |
img = stylegan2(latent_space, noise_mode='none')
|
| 24 |
img = Image.fromarray(np.array((img.permute(0, 2, 3, 1) * 127.5 + 128).clamp(0, 255).to(torch.uint8).squeeze(0)[20:-20,:,:]))
|
| 25 |
img.save('output.png')
|