Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save instead of show? #10

Open
Lifeling opened this issue Dec 22, 2020 · 2 comments
Open

Save instead of show? #10

Lifeling opened this issue Dec 22, 2020 · 2 comments

Comments

@Lifeling
Copy link

Im looking to have the colab save the file instead of show it inline. I've got it working somewhat, but the saved image is "inverted".
Any hints on getting the image to save nicely?

@akenmorris
Copy link

Try something like this:

output = img_hr.cpu().data[0]
o = output.numpy()
o[np.where(o < 0)] = 0.0
o[np.where(o > 1)] = 1.0
output = torch.from_numpy(o)
output = T.ToPILImage()(output)
output.save(args.output)

@jwenjian
Copy link

you can also refer to my simple flask demo, but I assume @akenmorris 's code is more reasonable

https://github.com/jwenjian/artline-demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants