How to Load a 'Learner' Model with a Custom Loss Function in a Flask Application

Seems OK.

The only thing I noticed is that you are not using any Fastai loss but pure pytorch losses.

Note that they are not fully compatible. You might want to look at this conversation for example :

1 Like