BART Large MNLI as a JSON web API
- Basically a web wrapper around this: https://huggingface.co/facebook/bart-large-mnli
- Ensure Python3 is installed
which python3
- Pip Install Pytorch
- Find the exact Pytorch installation needed for your environment https://pytorch.org/get-started/locally/
- But for Mac, it's
pip3 install torch
- Install transformers
pip3 install transformers
- Install flask
pip3 install flask
- Run flask
cd app
export FLASK_APP=main
export FLASK_ENV=development
flask run
- Test it out
curl -X POST http://localhost:5000/transform -d '{"sequence_to_classify": "one day I will see the world", "candidate_labels":["travel","cooking","dancing"]}' -H 'Content-Type: application/json'
- Note the presence of
requirements.txt
,Procfile
, andwsgi.py
. This app can be pushed to Heroku and it would just work.