This project implements a simple image inference serving system that handles HTTP requests to query the model and return the classification results. The backend server is a Flask application which uses a pre-trained Densenet-121 model from PyTorch to perform image classification. The server is hosted in a Docker container using a Python 3.7 image and a basic client program written in Python provides the ability to query the system using an HTTP POST request that sends the image file to the server. The server responds with the inferred class ID and class name for the specified image.
To run this repository, follow the following steps:
Install Docker Desktop and ensure that Docker is running on your computer.
Now, open the root folder of this repository in the command line.
Run command sudo docker-compose build
Run the command docker run -p 5000:5000 ml_inference_team_20
To run inference, the image needs to be placed in the images
folder.
Run the command, python send_request.py <image filename>
to run inference. For eg., python send_request.py cat.png
For automated testing run ./run_inference.sh
to run a shell script that builds the Docker image, runs the Flask app and send an image to the server for inference.
https://drive.google.com/file/d/15YYmHstMYjPZfnMgMSvYgHlpvXL0hbc6/view?usp=sharing