Solved by Anakin in post #2 
              
              
                Hello @John_J_Watson, 
Perhaps you have already checked these links: DEPLOYING PYTORCH IN PYTHON VIA A REST API WITH FLASKand PyTorch Flask API. Especially, the second one shows that the load_model function can be written somewhere else, not in the script where flask lauches directly. 
So the flask …