Starter code to use NodeJS with a Python layer for the model. Useful for deploying deep learning models if you want to use NodeJS as your web framework. Includes an extremely basic front-end built with Pug.
By default, this boilerplate runs a pre-trained resnet34 model that classifies Black Bears, Grizzly Bears, and Teddy Bears (h/t to fast.ai).
Extended from Node-Python by navjotts
In the root folder:
$ npm install
$ pip install -r requirements.txt
$ npm start
Export your Pytorch model as model-name.pth
.
Put your .pth
in /models
.
At the top of model_fastai.py
you'll see:
# SETUP HERE
YOUR_CLASSES_HERE = ['black', 'grizzly', 'teddys'] # Your class labels
NAME_OF_PTH_FILE = 'stage-2' # Name of your exported `.pth` file
- Add your class labels
- Add the name of your
.pth
- If you put your
.pth
file somewhere other than/models
, replacePATH_TO_MODELS_DIR
with that directory. npm start
Something broken? https://twitter.com/zachcaceres