How to convert PyTorch tensor to image and send it with flask? How to convert PyTorch tensor to image and send it with flask? flask flask

How to convert PyTorch tensor to image and send it with flask?


Logically speaking, since the static image works, the error is somewhere in your getLinearImage code. I would suggest running things through using PDB (or a debugger of your choice) to figure out why it's not generated correctly.

That said, I create a variable in your code:

numpu = (numpy + 1) * 128

which you don't seem to use, since you return the other variable afterwards:

return numpy

Could that be your problem?

Also: I presume that when you created this, you saved the original image locally to ensure something gets generated in the first place?