Deploy ml model with fastapi and docker container.
- create and activate a virtual env
python -m venv virtual-env
source virtual-env/bin/activate
- Install requirements
pip install -r requirements.txt
- Generate model dump (optional)
python models/generate_pipeline.py
uvicorn main:app --app-dir api
- Build docker image
docker build -t deploy-ml-fastapi .
- Run docker container
docker run -d --name sentiment-analysis-api -p 80:80 deploy-ml-fastapi