Serving ML Model — Photo2Cartoon and RetinaFaceAntiCov

Serving Photo2Cartoon and RetinaFaceAntiCov machine learning models using FastAPI and Streamlit.

Overview

Setup

The command basically runs the docker-compose command to create the Docker images and containers and then runs the start-up scripts.

Below is the content of the Makefile.

up:
docker-compose up
build:
docker-compose build
down:
docker-compose down
restart:
make build
make up

The application shall take a while to start as there are quite a number of steps to be executed. Once started, log in to http://localhost:8051 and you should see the Streamlit user interface.

Streamlit User Interface

Photo2Cartoon

Image from PaddleGAN

Let’s try with some images for fun.

Celebrity Photo
Celebrity Photo

RetinaFaceAntiCov

A white rectangle is drawn when a face mask is detected.

With Face Mask
With Face Mask

A green rectangle is drawn when there is no face mask.

Without Face Mask

Summary

References

Programmer and occasional blogger.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store