Serving ML Model — Photo2Cartoon and RetinaFaceAntiCov

3 min readApr 20, 2021

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


In my previous article, I talked about hosting machine learning models using FastAPI and Streamlit. In this article let’s continue to add additional models into the application.


The application is dockerized into 2 containers separately — 1 for the Streamlit frontend and another for the FastAPI backend. To bring up the application, clone the repository here and run the “make up” command under serving-ml-models folder.

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.

docker-compose up
docker-compose build
docker-compose down
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


For this model, I am going to use PaddleGAN. For this model, the cartoon style is more realistic and contains unequivocal ID information

Image from PaddleGAN

Let’s try with some images for fun.

Celebrity Photo
Celebrity Photo



Software engineer, Data Science and ML practitioner.