Using fastai in standalone python script

Based on lesson 1 code, I have created a file cars.ipnb (see to predict car models. Code is pretty experimental to say the least.
I am trying to see if I can use the saved pth file in a standalone python to just do the inference.
I am seeing lot of dependencies of fastai library on matplotlib.

Here’s the error I see when trying to run fastai from standalone python code.

File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/”, line 19, in
from matplotlib.backends import _macosx

I can go ahead and and change the code to make it work I guess.
But is there a better way to use it in standalone python code?

If you share your script we can help you make it work.

Hello Jeremy, thanks for responding.
I am able to get past the matplotlib error, I was running from pycharm with wrong env.
I am now able to run the inference script as standalone.
Here’s the link to the code
I am writing too much code to just do the inference ( For example I am referring to
training data images which should not be the case.)

Please advice me on how to do inference with minimal code.

1 Like

Did you get the advice you needed?