This documents shows how to deploy a Deep learning model using fast api. It will be using this MNIST-CNN Model.
Before going through the steps make sure you have the following pre-installed
- Python 3.6+
- Virtualenv
Make sure to download/clone this repository and navigate to the folder in yout terminal. Now follow the indtructions below
- Create the virtual environment.
virtualenv /path/to/venv --python=/path/to/python3
You can find out the path to your python3
interpreter with the command which python3
.
-
Activate the environment and install dependencies.
source /path/to/venv/bin/activate pip install -r requirements.txt
./path/to/venv/bin/activate pip install -r requirements.txt
-
Launch the service
uvicorn main:app --workers 1 --host 0.0.0.0 --port 8008
When the service is running, try this link in your browser
127.0.0.1:8008/docs
You can test the model with the Sample MNIST Image from How to Develop a CNN for MNIST Handwritten Digit Classification below using postman
1. Download this sample image for testing |
2. Using Postman: upload image |
3. Using Postman: send a Post Request |
- MNIST CNN Model repo
- Tutorial: How to deploy your ConvNet classifier with Keras and FastAPI article
- How to Develop a CNN for MNIST Handwritten Digit Classification