Skip to content

iamr0b0tx/deploy_DL_project_with_fastapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy a Deep learning project with fastapi

This documents shows how to deploy a Deep learning model using fast api. It will be using this MNIST-CNN Model.

Project setup

Before going through the steps make sure you have the following pre-installed

Prerequisite

  1. Python 3.6+
  2. Virtualenv

Make sure to download/clone this repository and navigate to the folder in yout terminal. Now follow the indtructions below

  1. 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.

  1. Activate the environment and install dependencies.

    • Linux

        source /path/to/venv/bin/activate
        pip install -r requirements.txt
    
    • Windows

        ./path/to/venv/bin/activate
        pip install -r requirements.txt
    
  2. Launch the service

    uvicorn main:app --workers 1 --host 0.0.0.0 --port 8008

Posting requests locally

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

Download this sample image for testing
1. Download this sample image for testing
Using Postman: upload image
2. Using Postman: upload image
Using Postman: send a Post Request
3. Using Postman: send a Post Request

Refrences

  1. MNIST CNN Model repo
  2. Tutorial: How to deploy your ConvNet classifier with Keras and FastAPI article
  3. How to Develop a CNN for MNIST Handwritten Digit Classification

About

How to deploy a machine learning project with fastapi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages