The purpose of this repository is to learn more about deploying a machine learning service in a public cloud provider. I built a simple sentiment analysis app using FastAPI and a HuggingFace basic model.
1st step, EC2 ✅: I got to deploy it in an EC2 instance! Had some trouble as the free t2.micro intance only has 1GB of RAM so we can't use big models and Pytorch has to be installed without caching. Also configuring gunicorn and nginx to make it available on the public Internet needed a few shots but got it in the end.
Next step:
🔜 Learn more ways to serve it in AWS, probably using Lambda :)
The first step is to download this repo
git clone https://github.com/miedc/simple-nlp-app.git
Then, I recommend you install everything in a virtual environment. I use the included manager that comes with most Python versions: “venv”.
py -3.10 -m venv .venv
activate the environment
.venv\Scripts\activate
and install the package and the dependencies
pip install -r requirements.txt
Run
python -m app
and if you navigate to http://127.0.0.1:8000/ you'll be able write a sentence.
@alexmolas for the idea in this blog and providing the code I used as a base: A search engine in 80 lines