Build a simple machine learning web application using Streamlit and deploy on Heroku in 5 easy steps

how to build a simple web application to serve ML Pipeline in Python and deploy it on Heroku cloud service in few easy steps.

Moez Ali
10 min readSep 23, 2022


Image by Author (Created using DALLE-2)


By the end of this tutorial, you will be able to build a fully functional web app to generate online predictions (one-by-one) and predictions by batch (by uploading a csv file) using trained machine learning model. The final app looks like this:

What you will learn in this tutorial

  • What is a deployment and why do we deploy machine learning models?
  • Develop a machine learning pipeline and train models using PyCaret.
  • Build a simple web app using a Streamlit open-source framework.
  • Deploy a web app on ‘Heroku’ and see the model in action.

This tutorial will cover the entire workflow starting from training a machine learning model and developing a pipeline in Python, developing a simple web app using streamlit and deploying the app on the Heroku cloud platform.

In the past, we have covered containerization using docker and deployment on cloud platforms like Azure, GCP and AWS. If you are interested in learning more about those, you can read the following stories:

💻 Toolbox for this tutorial


PyCaret is an open source, low-code machine learning library in Python that is used to train and deploy machine learning pipelines and models into production. PyCaret can be installed easily using pip.

pip install pycaret


Streamlit is an open-source Python library that makes it easy to build beautiful custom web-apps for machine learning and data science. Streamlit can be installed easily using pip.

pip install streamlit