Build Machine Learning Pipeline in Python and Deploy on Cloud easily

Moez Ali
9 min readAug 19, 2022

An end-to-end beginner’s guide to build machine learning pipeline in Python using PyCaret and deploy on Heroku Cloud

Photo by Igor Lypnytskyi 🇺🇦 on Unsplash

Introduction

In this tutorial we will build machine learning pipeline from scratch in Python using PyCaret library and a front-end web app using Flask framework and deploy it on Heroku cloud in few simple steps. You will learn:

  • What is a deployment and why we deploy ML pipelines.
  • Develop a machine learning pipeline using PyCaret.
  • Build a simple front-end web app using Flask framework.
  • Deploy ML pipeline with front-end web app on Heroku Cloud.
Image by Author

See live demo of app you will learn to build in this tutorial here

App you will build — https://pycaret-insurance.herokuapp.com/

Tools we will use in this tutorial

PyCaret

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

# install pycaret
pip install pycaret

Flask

Flask is a framework that is used for building web applications in Python. A web application can be a commercial website, a blog, e-commerce system, or an application that generates predictions from data provided in real-time using trained models. If you don’t have Flask installed, you can use pip to install it.

# install flask
pip install flask

Heroku

Heroku is a platform as a service (PaaS) that enables the deployment of web apps based on a managed container system, with integrated data services and a powerful ecosystem. In simple words, this will allow you to take the application from your local machine to the cloud so that anybody can access it using a Web URL.