MLOps: Mastering Machine Learning Deployment: An Intro to Docker, Kubernetes, Helm, and Modern Web Frameworks-End To End Project

Streamlit, Gradio, FastAPI, Flask, Terraform, Spinnaker, Puppet


In the dynamic world of machine learning, the journey from developing a model to putting it into production is often seen as intricate and multifaceted. However, with the advent of tools like Docker, Kubernetes and user-friendly web frameworks such as FastAPI, Streamlit, and Gradio, this journey has become more streamlined than ever. Coupled with the power of GitHub Actions for continuous integration and deployment, we now have an ecosystem that supports rapid, efficient, and scalable machine learning applications. This article provides a concise guide on the essential commands for these tools, aiming to bridge the gap between model development and seamless deployment. Whether you’re a seasoned data scientist looking to venture into the deployment realm or a budding developer eager to integrate machine learning into web applications, this guide offers a foundational understanding to propel your endeavors.

Image by the Author


  1. Docker
  2. Kubernetes
  3. Helm
  4. GitHub Actions
  5. Streamlit
  6. Python Flask
  7. Gradio
  8. FastAPI
  9. Terraform
  10. Spinnaker
  11. Crossplane
  12. Puppet
  13. Conclusion
  14. References
Image by the Author
Image by the Author


What is Docker?

  • Definition: Docker is a platform that allows developers to package applications and their dependencies into containers.
  • Containerization: Unlike traditional virtualization, Docker containers share the host system’s OS kernel rather than including their own operating system. This makes them lightweight and fast.
  • Portability: Containers ensure that applications run consistently across multiple environments, from a developer’s local machine to various production setups.
Image by the Author

Why is Docker Essential for ML Deployment?

  • Environment Consistency: Ensures that the model runs with the same dependencies and libraries in development, testing, and production.
  • Reduces the “It works on my machine” problem.
  • Scalability: Docker containers can be easily scaled up or down based on the application’s demand.
  • Isolation: ML models, especially those in a microservices architecture, might have different dependencies. Docker isolates these dependencies to avoid conflicts.
  • Version Control for Environments: Just as with code, Docker allows for versioning of environments. If a newer library version breaks the model, one can easily revert to the older, working container version.
  • Efficient Resource Utilization: Docker containers are lightweight and use resources efficiently, which is essential for deploying multiple ML models on the same infrastructure.
  • Integration with Modern Deployment Pipelines: Docker seamlessly integrates with CI/CD tools and orchestration systems like Kubernetes, facilitating automated testing and deployment.
  • Collaboration: Data scientists, ML engineers, and developers can share Docker containers, ensuring everyone is working in a consistent environment.

Docker Installation:

Check Docker documentation installation

Get Docker

Download and install Docker on the platform of your choice, including Mac, Linux, or Windows.

Docker Version:

$ docker --version

Creating a Dockerfile for Python & Machine Learning

The Dockerfile defines what goes into your container. Here’s an example Dockerfile for a Python machine learning environment:

# Use an official Python runtime as base image
FROM python:3.8-slim

# Set the working directory inside the container
WORKDIR /usr/src/app

# Install essential libraries and tools
RUN apt-get update && \
apt-get install -y build-essential

# Copy the requirements.txt into the container
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Command to run when the container starts
CMD ["python", ""]

Dockerfile Breakdown:

  • Base Image:
  • FROM python:3.8-slim
  • This instructs Docker to use the official Python 3.8 image in its “slim” variant as the starting point for this container. The slim version is a lighter version of the image with fewer pre-installed tools and smaller size.
  • Setting Working Directory:
  • WORKDIR /usr/src/app
  • This sets the working directory inside the container to /usr/src/app. All subsequent commands will be run from this directory.
  • Installing Essential Libraries:
  • RUN apt-get update && \
  • apt-get install -y build-essential
  • This updates the package lists for upgrades and new package installations. After updating, it installs the “build-essential” package, which contains compilers and libraries essential for building software.
  • Copying Requirements:
  • COPY requirements.txt .
  • This command takes the requirements.txt file from your current directory (on your host machine) and copies it to the working directory inside the container (/usr/src/app).
  • Installing Python Dependencies:
  • RUN pip install --no-cache-dir -r requirements.txt
  • Using pip, this command installs the Python libraries listed in the requirements.txt file. The --no-cache-dir option ensures pip won’t store any cache, keeping the container lightweight.
  • Startup Command:
  • CMD ["python", ""]
  • Specifies the command that should run when the container starts. In this case, it runs the Python script

Requirements File:

Your requirements.txt might look something like this for a machine learning project:


Building a Docker Image

To create a Docker image from your Dockerfile:

$ docker build -t ml-python-image .

The -t flag assigns a tag or name to the image, and the . specifies the directory containing your Dockerfile.

Running a Docker Container

To initiate a container from your image:

$ docker run --name ml-python-container ml-python-image

Viewing Running Containers

To see a list of all running containers:

$ docker ps

For all containers, including those that aren’t running:

$ docker ps -a

Stopping and Removing Containers

To stop a running container:

$ docker stop ml-python-container

To remove a stopped container:

$ docker rm ml-python-container

Sharing your Docker Image

You can share your Docker image using Docker Hub, a cloud service for sharing container images. First, log in:

$ docker login

Then, tag your image:

$ docker tag ml-python-image:latest username/ml-python-image:latest

Finally, push the image:

$ docker push username/ml-python-image:latest

Pulling and Running Shared Images

You or others can then pull the image:

$ docker pull username/ml-python-image:latest

And run it:

$ docker run --name new-ml-python-container username/ml-python-image:latest

Check out my article about Docker and Kubernetes if you want to know more :

MLOps-Dockers and Kubernetes Essentials for a Data Scientist


All in one

# General
docker --version # Version Information
docker info # Docker Configuration Info

# Images
docker images # List Images
docker build -t [image-name]:[tag] . # Build an Image
docker rmi [image-name]:[tag] # Remove an Image
docker pull [image-name] # Pull an Image

# Containers
docker ps # List Running Containers
docker ps -a # List All Containers
docker run -d -p [host-port]:[container-port] [image-name] # Start a Container
docker stop [container-id] # Stop a Container
docker rm [container-id] # Remove a Container
docker logs [container-id] # View Container Logs

# Docker Compose (if you're using it)
docker-compose up # Start Services
docker-compose down # Stop Services

# Maintenance
docker system prune # Remove All Unused Containers, Networks, and Images
docker volume prune # Remove All Unused Volumes
docker system df # Check Docker Disk Usage

# Dockerfile Basics (For reference, not executable as commands)
# FROM [base-image] # Base Image
# WORKDIR /path/to/directory # Set Working Directory
# RUN command # Run Commands
# COPY source destination # Copy Files
# EXPOSE port # Expose Port
# CMD ["executable", "param1", "param2"] # Default Command


Image by the Author

Kubernetes Basics

1. Nodes and Clusters: A node is a machine, VM, or cloud instance, and a cluster is a group of nodes managed by Kubernetes. The Master node manages the cluster while Worker nodes run the applications.

2. Pods: The smallest deployable units in Kubernetes are pods. A pod can host multiple containers that form a single unit of deployment.

3. Services: A Kubernetes Service is an abstract way to expose an application running on a set of Pods.

4. Deployments: This is a higher-level concept that manages the desired state of pods and replica sets.

Setting up Kubernetes:

Kubernetes can be set up on local machines using Minikube or on cloud platforms. Cloud providers like AWS, GCP, and Azure offer managed Kubernetes services like EKS, GKE, and AKS, respectively.

Deploying a Machine Learning Model on Kubernetes:

1. Containerize your Model: Before deploying on Kubernetes, your model needs to be containerized. Docker is typically used for this:

FROM python:3.8-slim
WORKDIR /appCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txtCOPY . /appCMD ["python", ""]

This Dockerfile assumes you have an that serves your model, perhaps using a framework like Flask or FastAPI.

Build and push your Docker image:

$ docker build -t username/ml-model:v1 .
$ docker push username/ml-model:v1

2. Create a Deployment Configuration: Define a deployment.yaml for Kubernetes:

apiVersion: apps/v1
kind: Deployment
name: ml-model-deployment
replicas: 3
app: ml-model
app: ml-model
- name: ml-model
image: username/ml-model:v1
- containerPort: 5000

Kubernetes Deployment Manifest Breakdown:

  • API Version:
  • apiVersion: apps/v1
  • Specifies the Kubernetes API version to use. For deployments, “apps/v1” is commonly used.
  • Kind:
  • kind: Deployment
  • Indicates the kind of Kubernetes resource we want to create. In this case, it’s a “Deployment”, which ensures that a specified number of pod replicas are running at any given time.
  • Metadata:
  • metadata:
  • Contains data that helps uniquely identify the Deployment object.
  • name: ml-model-deployment
  • Names the deployment as “ml-model-deployment”.
  • Spec (Specification):
  • spec:
  • Defines the desired state for the deployment.
  • replicas: 3
  • Specifies that three replicas (instances) of the application should be running.
  • Selector:
  • selector:
  • Helps the Deployment find which Pods to manage.
  • matchLabels:
  • Defines the selection criteria. It should match the labels defined in the Pod template.
  • app: ml-model
  • The Deployment manages Pods with the label “app” set to “ml-model”.
  • Template:
  • template:
  • Contains the Pod definition.
  • metadata:
  • Contains metadata for the Pod.
  • labels:
  • app: ml-model
  • Sets the label “app” to “ml-model” for the Pods. This should match the matchLabels section above.
  • Containers:
  • containers:
  • Defines the container(s) that should be started when the Pod is instantiated.
  • - name: ml-model
  • Names the container “ml-model”.
  • image: username/ml-model:v1
  • Specifies the Docker image to use for the container. Here, it references version “v1” of an image named “ml-model” from a repository belonging to “username”.
  • ports:
  • Lists the network ports the container will use.
  • - containerPort: 5000
  • Specifies that the container will listen on port 5000. This would be the port where your ML model’s serving API (e.g., a Flask or FastAPI application) is listening.

3. Deploy on Kubernetes:

Apply the deployment:

$ kubectl apply -f deployment.yaml

4. Expose Your Model:

To access your model, expose it using a service:

$ kubectl expose deployment ml-model-deployment --type=LoadBalancer --port=80 --target-port=5000
  • expose:
  • This tells kubectl that you want to expose a resource (in this case, a deployment) as a network service.
  • deployment ml-model-deployment:
  • Specifies the type of the resource (deployment) and the name of that resource (ml-model-deployment) you want to expose.
  • --type=LoadBalancer:
  • This specifies the type of the service you want to create. In this case, a LoadBalancer service is being requested. When used in cloud environments (like AWS, GCP, or Azure), this typically provisions a cloud load balancer to distribute network traffic to all the Pods associated with this service.
  • --port=80:
  • Defines the port on which the service will listen. This means external traffic will come into the service on this port.
  • --target-port=5000:
  • Specifies the port on the pod to which the service should forward the traffic. In the context of the earlier deployment, our application inside the container listens on port 5000. So, external traffic coming in on port 80 (as specified by --port) will be forwarded to port 5000 on the pods.

Retrieve the service URL:

$ kubectl get services

You can then access your machine learning model via the provided URL.

5. Scaling Your Deployment:

Kubernetes makes it easy to scale your deployments:

$ kubectl scale deployment ml-model-deployment --replicas=5
  • scale:
  • This tells kubectl that you intend to change the number of replicas (i.e., adjust the scale) for a particular resource, in this case, a deployment.
  • deployment ml-model-deployment:
  • Specifies the type of the resource (deployment) and the name of that resource (ml-model-deployment) that you want to scale.
  • --replicas=5:
  • Specifies the desired number of replicas you wish to have for the deployment. This means Kubernetes will ensure that there are 5 identical pods (replicas) running for the ml-model-deployment.

Kubernetes provides a robust environment for deploying machine learning models, ensuring they’re highly available and scalable.

Image by the Author

Check out my article about an End to End project using Docker and Kubernetes:

MLOps End-To-End Machine Learning Pipeline-CICD

The main objective of this project is to automate the whole machine learning app deployment process. To implement this…

All in one go:

# Cluster Info
kubectl cluster-info

# Get resources
kubectl get nodes
kubectl get pods
kubectl get services
kubectl get deployments

# Describe resources
kubectl describe node <node-name>
kubectl describe pod <pod-name>
kubectl describe service <service-name>
kubectl describe deployment <deployment-name>

# Create resources
kubectl create -f <filename.yaml>
kubectl apply -f <filename.yaml> # idempotent version of 'create'

# Delete resources
kubectl delete -f <filename.yaml>
kubectl delete pod <pod-name>
kubectl delete service <service-name>
kubectl delete deployment <deployment-name>

# Logs & Debugging
kubectl logs <pod-name>
kubectl exec -it <pod-name> -- /bin/bash

# Scale deployments
kubectl scale deployment <deployment-name> --replicas=<number>

# Rolling updates and rollbacks
kubectl set image deployment/<deployment-name> <container-name>=<new-image>
kubectl rollout history deployment/<deployment-name>
kubectl rollout undo deployment/<deployment-name>

# Configuration
kubectl config view
kubectl config use-context <context-name>

# Namespace operations
kubectl get namespaces
kubectl create namespace <namespace-name>
kubectl delete namespace <namespace-name>
kubectl get pods --namespace=<namespace-name>

# Port forward
kubectl port-forward <pod-name> <local-port>:<pod-port>

Check out my article on Yaml for more details:

Everything You Need to Know About YAML

Syntax, data types, styling, utilities, and more


Image by the Author

Introduction to Helm:

Helm is often dubbed as the package manager for Kubernetes. With machine learning models becoming more complex and the infrastructure around them growing larger, Helm simplifies the deployment process.

  • Charts: Helm uses “charts”, which are packages of pre-configured Kubernetes resources. Imagine them as a packaged application.
  • Releases: When a chart is deployed on Kubernetes, it’s called a release.
  • Simplicity: Instead of handling several different Kubernetes manifest files, you only need to manage a singular Helm chart.

Setting Up Helm:

Before you can dive into deploying your ML model using Helm, you need to set it up.

  • Install Helm: Download and install Helm from the official website or use a package manager like brew.
  • Initialize Helm: Once installed, run helm init to set up the Helm environment.
  • Add Repositories: Helm charts are stored in repositories. Add the required repositories using helm repo add.

Basic Helm Commands for ML Deployment

  • Searching for Charts: helm search repo lets you find charts in your added repositories.
  • Install a Chart: helm install [chart-name] will deploy the chart onto your Kubernetes cluster.
  • Upgrading and Rolling Back: Changed something in your ML model? helm upgrade lets you upgrade your release with the newer chart. Made a mistake? helm rollback will revert to a previous version.
  • Deleting a Release: helm delete [release-name] will remove the release from Kubernetes.

Deploying an ML Model using Helm

Let’s take a hypothetical scenario where you have an ML model for image recognition:

  • Prepare the Model: Train your model and expose it as an API (using Flask, FastAPI, Streamlit, etc.).
  • Dockerize the Model: Create a Docker image of your ML application.
  • Create a Helm Chart: Structure a Helm chart for your ML model, ensuring to define necessary resources like Deployments, Services, and any ConfigMaps or Secrets if needed.
  • Deployment: Deploy your ML model using helm install [chart-name]. Kubernetes will create the resources defined in the chart.

Benefits of Using Helm for ML Deployments

  • Version Control: Helm charts are versioned, ensuring you can manage different versions of your ML application seamlessly.
  • Atomic Deployments: Helm ensures that releases are atomic. This means either all resources are successfully deployed, or none are, ensuring consistent states.
  • Reusability and Sharing: You can easily package and share Helm charts. This is beneficial if you have similar deployment structures across different ML models or teams.
  • Complex Deployments Simplified: ML workflows can be intricate, especially when combined with data pipelines. Helm allows defining complex workflows in a maintainable manner.

Here’s a guide to some fundamental Helm commands:

Setup and Installation:

  • Install Helm:
curl -fsSL -o chmod 700 ./


  • Add a Helm Repository:
helm repo add [repo_name] [repo_url]

Update Repository Information:

helm repo update


  • Search for Helm Charts:
helm search repo [search_term]
  • Install a Helm Chart:
helm install [release_name] [repo_name]/[chart_name]
  • List All Installed Helm Releases:
helm list
  • Get Information About a Release:
helm status [release_name]

Updates and Rollbacks

  • Upgrade an Installed Release:
helm upgrade [release_name] [repo_name]/[chart_name]
  • Rollback a Release to a Previous Revision:
helm rollback [release_name] [revision_number]

Cleanup and Deletion:

  • Uninstall a Release:
helm uninstall [release_name]
  • Delete a Helm Repository:
helm repo remove [repo_name]

Local Chart Development

  • Create a New Helm Chart:
helm create [chart_name]
  • Lint a Helm Chart:
helm lint [chart_directory]
  • Package a Helm Chart:
helm package [chart_directory]

Repositories and Plugins:

  • List Added Helm Repositories:
helm repo list
  • Install a Helm Plugin:
helm plugin install [plugin_url]

For Helm, check out the documentation:

Docs Home

Everything you need to know about how the documentation is organized.

All basic commands in one go:

# Initialize Helm and install Tiller (for Helm 2)
helm init

# Helm version
helm version

# Add a new Helm chart repository
helm repo add <repo_name> <repo_url>

# Update Helm chart repository list
helm repo update

# Search for Helm charts
helm search repo <chart_name>

# Install a Helm chart
helm install <release_name> <chart_name>
# For Helm v3 and above, use:
helm install <release_name> <chart_name> --generate-name

# List all releases
helm list
# For Helm v3 and above, you might need:
helm list --all-namespaces

# Get information about a release
helm status <release_name>

# Upgrade a release
helm upgrade <release_name> <chart_name>

# Rollback a release to a previous revision
helm rollback <release_name> <revision_number>

# Uninstall a release
helm uninstall <release_name>

# View the values of a release
helm get values <release_name>

# Lint a Helm chart
helm lint <path_to_chart>

# Package a Helm chart into a versioned chart archive
helm package <path_to_chart>

# View Helm history
helm history <release_name>

# Create a new Helm chart
helm create <chart_name>

# Render Helm chart templates locally (dry-run)
helm template <chart_name>

# Pull a chart from a repository and download it to your machine
helm pull <chart_name>

Github Actions:

Image by the Author

GitHub Actions offer a powerful, integrated CI/CD solution, allowing developers to automate, customize, and execute software development workflows directly in their GitHub repositories. For machine learning developers working with Python, it provides a seamless environment to automate tasks such as testing, building, and deploying models.

Understanding GitHub Actions:

1. Workflows: These are automated procedures that you can set up in your repository to build, test, package, release, or deploy any code project on GitHub.

2. Events: Workflows are triggered by events. Common events include push and pull_request, but there are many others, like scheduled events or manual triggers.

3. Jobs: Jobs are a set of steps that execute on the same runner. Jobs can run in parallel, or be dependent on the success of another.

4. Steps: These are individual tasks that can run commands or actions.

5. Actions: These are standalone commands that are combined into steps to create a job. Actions can be provided by GitHub, community-driven, or custom to your repository.

Setting Up a Machine Learning CI/CD Pipeline with GitHub Actions:

1. Create a Workflow:In your repository, create a directory named .github/workflows. Add a new file, for instance ml_cicd.yml, to define your workflow.

2. Define Workflow Trigger:You can specify when your workflow should be triggered. For CI/CD, it’s common to use push:

on: [push]

3. Define Jobs for Testing and Deployment:Set up a job to test your machine learning code every time there’s a push event:

runs-on: ubuntu-latest
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
python-version: 3.8
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run tests
run: pytest

4. Deploying Your Model:After testing, you can add steps to deploy your model:

- name: Deploy model
run: |
# Your deployment script here, for example:

5. Caching and Matrix Builds:To speed up builds, use caching:

- name: Cache dependencies
uses: actions/cache@v2
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

For testing across multiple Python versions, use a matrix build:

python-version: [3.7, 3.8, 3.9]

6. Continuous Deployment:If you’re working with cloud platforms or container orchestration systems like Kubernetes, you can incorporate steps to deploy your ML models once tests pass.

- name: Deploy to Kubernetes
run: |
kubectl apply -f k8s-deployment.yaml

Some basic actions:

# Name of the workflow
name: CI/CD Workflow

# Event that triggers the workflow
- main
- main


name: Build Job
runs-on: ubuntu-latest
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run tests
run: pytest

name: Deploy Job
needs: build
runs-on: ubuntu-latest
- name: Checkout code
uses: actions/checkout@v2

- name: Deploy to server
run: ./

#sample file

Here’s a list of other popular CI/CD tools:

  1. Jenkins: One of the most popular open-source automation servers, Jenkins is used for building, deploying, and automating any project. It has a vast plugin ecosystem.
  2. Travis CI: Integrated with GitHub, Travis CI provides a cloud-based CI/CD service for open source and private projects.
  3. CircleCI: Offers both cloud-based and self-hosted CI/CD solutions. Integrated with GitHub and Bitbucket.
  4. GitLab CI/CD: Part of the GitLab platform, this built-in tool offers both the repository and CI/CD in a single service.
  5. Bamboo: Atlassian’s CI/CD server solution, Bamboo integrates closely with JIRA, Bitbucket, and other Atlassian products.
  6. Azure Pipelines: Part of Microsoft’s Azure DevOps services, it provides CI/CD capabilities and integrates with GitHub and external repositories.
Image by the Author
Image by the Author


Image by the Author

Introduction to Streamlit

Streamlit is an open-source app framework specifically crafted for Machine Learning and Data Science projects. With just a few lines of Python, you can swiftly turn your data scripts into interactive web applications without any need for HTML, CSS, or JavaScript knowledge. Streamlit’s simple syntax and rapid development cycle make it an enticing option for data scientists looking to demonstrate their projects.

Streamlit Installation & Basic Configuration

Installing Streamlit is as simple as:

pip install streamlit

To check that it’s been installed correctly:

streamlit hello

This command launches a sample Streamlit application in your web browser.

Building a Simple Streamlit ML App

Let’s create a machine learning model that predicts if an input text is positive or negative using the TextBlob library. We’ll then use Streamlit for interaction.

First, ensure you have the necessary libraries:

pip install streamlit textblob

Next, create a Python script (

import streamlit as st
from textblob import TextBlob
st.title('Sentiment Analysis Using Streamlit')
user_input = st.text_area("Enter Text:", "Type Here...")
if st.button("Analyze"):
blob = TextBlob(user_input)
result = blob.sentiment.polarity
if result > 0:
st.write("Positive Sentiment")
elif result < 0:
st.write("Negative Sentiment")
st.write("Neutral Sentiment")

Run your Streamlit app:

streamlit run

This will launch the application in your browser where you can type text and get its sentiment.

Containerizing with Docker

For production deployment and consistency across platforms, you might want to containerize your Streamlit application.

Dockerfile for Streamlit:

FROM python:3.8-slim
COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
COPY . .
CMD ["streamlit", "run", ""]

Here, the requirements.txt would have:


Build and run the Docker container:

docker build -t ml-streamlit-app:latest .
docker run -p 8501:8501 ml-streamlit-app:latest
Image by the Author

All in one go:

### Streamlit Commands ###

# 1. Install Streamlit
pip install streamlit

# 2. Create a new Streamlit script
echo 'import streamlit as st\n\nst.write("Hello, world!")' >

# 3. Run a Streamlit app
streamlit run

# 4. Secure your Streamlit app (you can set tokens, passwords, etc.)
# Use third-party tools or services for this.
streamlit run --secure-mode

# 5. Set the Streamlit server port (e.g., to 9999)
streamlit run --server.port 9999

# 6. Disable the Streamlit welcome page
streamlit run --server.headless true

# 7. Cache data to speed up your Streamlit app
# In your script, you can use the @st.cache decorator for functions you want to cache.
# Example:
# @st.cache
# def fetch_data():
# return download_your_data_here()

# 8. Deploying Streamlit app with Streamlit sharing
# - First, push your app to a public GitHub repository.
# - Then use Streamlit sharing (a service by Streamlit) to deploy directly from the repository.
# Check the Streamlit documentation for more on this.

### Streamlit Components ###

# Streamlit offers various components like buttons, sliders, file uploaders, etc.
# Here are examples of a few:

# In your

# st.button('Click me!')
# st.slider('Select a range', 0.0, 100.0)
# st.file_uploader('Upload a file here')
# st.selectbox('Choose an option', ['Option 1', 'Option 2', 'Option 3'])

Check out Streamlit tutorials:

Tutorials – Streamlit Docs

Our tutorials include step-by-step examples of building different types of apps in Streamlit.

Image by the Author


Image by the Author

Flask for Machine Learning Deployment: A Beginner’s Guide

Table of contents:

  1. Introduction to Flask
  2. Flask Installation & Basic Configuration
  3. Building a Simple Flask ML App
  4. Containerizing with Docker
  5. Wrapping Up

Introduction to Flask

Flask is a lightweight web server framework in Python. Its micro-framework nature makes it perfect for creating small to medium web applications quickly. It’s particularly well-suited for deploying machine learning models, as it allows for flexibility and offers a direct path from your Python code to a web service.

Flask Installation & Basic Configuration

Start by installing Flask using pip:

pip install Flask

To check that it’s been installed correctly, you can create a basic Flask application:

from flask import Flask
app = Flask(__name__)
def hello_world():
return 'Hello, World!'

Save this as and run:

flask run

This command starts your Flask app, and you should see Hello, World! when you navigate to in your browser.

Building a Simple Flask ML App

Imagine we have a machine learning model that predicts if an input text is positive or negative using the TextBlob library. We’ll use Flask to create a simple API for this model.

First, ensure you have the necessary libraries:

pip install Flask textblob

Next, update

from flask import Flask, request, jsonify
from textblob import TextBlob
app = Flask(__name__)
@app.route('/analyze', methods=['POST'])
def analyze_sentiment():
data = request.get_json()
text = data['text']
blob = TextBlob(text)
result = blob.sentiment.polarity
sentiment = ""
if result > 0:
sentiment = "Positive"
elif result < 0:
sentiment = "Negative"
sentiment = "Neutral"
return jsonify(sentiment=sentiment)
if __name__ == "__main__":

This Flask app exposes a POST endpoint /analyze that expects a JSON object with a key text and returns the sentiment of the provided text.

Containerizing with Docker

For ease of deployment and ensuring consistency across different environments, it’s useful to containerize the Flask application.

Dockerfile for Flask:

FROM python:3.8-slim
COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
COPY . .
CMD ["python", ""]

Your requirements.txt should contain:


To build and run the Docker container:

docker build -t ml-flask-app:latest .
docker run -p 5000:5000 ml-flask-app:latest

All in one go:

# Create a virtual environment
python -m venv myenv

# Activate the virtual environment
# On Windows:
# On macOS and Linux:
source myenv/bin/activate

# Install Flask
pip install Flask

# Use this structure in your Python script (e.g.,
from flask import Flask
app = Flask(__name__)

def hello_world():
return 'Hello, World!'

# Set the FLASK_APP environment variable
# On Windows:
# On macOS and Linux:

# Run the app
flask run

# Activate the development environment
# On Windows:
set FLASK_ENV=development
# On macOS and Linux:
export FLASK_ENV=development

# Now run the app
flask run

flask run --host= --port=8080

# ---- USING FLASK EXTENSIONS (example: Flask-SQLAlchemy) ----
# Install Flask-SQLAlchemy
pip install Flask-SQLAlchemy
# Use in your Flask app:
from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///your_database_name.db'
db = SQLAlchemy(app)


Check out flask documentation:

Welcome to Flask – Flask Documentation (2.3.x)

Welcome to Flask’s documentation. Get started with Installation and then get an overview with the Quickstart . There is…


Image by the Author

Introduction to Gradio

Gradio is an open-source Python library that provides an easy way to create user-friendly web-based interfaces for machine learning models. It is designed to be straightforward, allowing ML practitioners to deploy and share their models with non-technical users quickly.

Gradio Installation & Basic Configuration

Installing Gradio is simple with pip:

pip install gradio

With Gradio installed, you can quickly create interfaces for your models without needing extensive web development expertise.

Building a Simple Gradio ML App

Let’s assume we have a machine learning model that classifies handwritten digits from the MNIST dataset. We’ll use Gradio to create a simple UI for this model.

First, ensure you have the necessary libraries:

pip install gradio tensorflow

Next, build a simple model using TensorFlow and integrate it with Gradio:

import gradio as gr
import numpy as np
import tensorflow as tf

# Load MNIST dataset
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0 # Normalize data

# Build a simple model
model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(512, activation='relu'),
metrics=['accuracy']), y_train, epochs=5)

def classify_digit(img):
img = img.reshape(1, 28, 28)
prediction = model.predict(img).tolist()[0]
return {str(i): prediction[i] for i in range(10)}

# Gradio UI
interface = gr.Interface(fn=classify_digit,

Running this script will train the model on the MNIST dataset and then launch a Gradio interface where you can draw digits, and the model will classify them.

Containerizing with Docker

To ensure our app is consistent across various environments and to streamline deployment, it’s helpful to containerize the Gradio application.

Dockerfile for Gradio:

FROM python:3.8-slim
COPY requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", ""]

Your requirements.txt should contain:


To build and run the Docker container:

docker build -t ml-gradio-app:latest .
docker run -p 7860:7860 ml-gradio-app:latest

This command will launch the Gradio app in a Docker container and make it available on port 7860.

Check out Gradio tutorials


A Step-by-Step Gradio Tutorial

Also, check out the deep learning gradio course for free:

Building Generative AI Applications with Gradio

Join our new short course, Building Generative AI Applications with Gradio! Learn from Apolinário Passos, Machine…

Image by the Author


Image by the Author

Introduction to FastAPI:

FastAPI is a modern, fast web framework for building APIs with Python, based on standard Python type hints. It offers automatic interactive API documentation, is built on top of Starlette for the web parts and Pydantic for the data parts, and is recognized for its performance, even comparable to NodeJS and Go.

Docker and Why It Matters:

Docker allows you to package an application with all of its dependencies into a standardized unit for software development. This ensures that your application will run the same, regardless of where the Docker container runs. For ML, this is crucial as you often have numerous dependencies that can cause conflicts or versioning issues.

FastAPI with Docker for ML Deployment:

FastAPI can be dockerized like any other web application. Given FastAPI’s fast performance, it is well-suited to be a server for machine learning models, especially when combined with Docker’s consistency and isolation.

Hands-On Example:

a. Create a FastAPI Application:
Let’s create a simple FastAPI application to serve a machine learning model. For this guide, we’ll use a pre-trained model for simplicity.

from fastapi import FastAPI
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
app = FastAPI()
# Load dataset and train a simple model
X, y = load_iris(return_X_y=True)
clf = LogisticRegression().fit(X, y)
def predict(sepal_length: float, sepal_width: float, petal_length: float, petal_width: float):
prediction = clf.predict([[sepal_length, sepal_width, petal_length, petal_width]])
return {"prediction": int(prediction[0])}

b. Create a Dockerfile:
Now, let’s Dockerize the FastAPI application.

# Use an official Python runtime as a base image
FROM python:3.8-slim
# Set the working directory
# Install dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy the current directory contents into the container at /app
COPY . .
# Expose port 8000 for FastAPI
# Run when the container launches
CMD ["uvicorn", "main:app", "--host", "", "--port", "8000"]
  • FROM python:3.8-slim: Use the slim version of the official Python 3.8 image as the base image for this Docker container.
  • WORKDIR /app: Set the working directory in the container to /app. All subsequent commands will be run from this directory.
  • COPY requirements.txt ./: Copy the requirements.txt file from your host to the current location (/app) in the container.
  • RUN pip install --no-cache-dir -r requirements.txt: Install the Python dependencies specified in requirements.txt without storing the cache, which keeps the image size smaller.
  • COPY . .: Copy all the files from the current directory on the host to the current directory (/app) in the container.
  • EXPOSE 8000: Informs Docker that the container will listen on the specified network port at runtime, which in this case is 8000.
  • CMD ["uvicorn", "main:app", "--host", "", "--port", "8000"]: Specifies the command that will be executed when the container starts up. Here, it’s launching the FastAPI application using Uvicorn on host and port 8000.

Each instruction creates a new layer in the Docker image, and they’re executed in sequence to build the final image. This Dockerfile is set up to run a FastAPI application in a containerized environment.

Your requirements.txt should have:


c. Build and Run with Docker:
With Docker installed, navigate to your project’s root directory and run:

$ docker build -t fastapi_ml_app .
$ docker run -p 8000:8000 fastapi_ml_app

Visit http://localhost:8000/predict/?sepal_length=5.1&sepal_width=3.5&petal_length=1.4&petal_width=0.2 in your browser. You should see a prediction output.

Check out FastAPI tutorials:

Tutorial – User Guide – FastAPI

FastAPI framework, high performance, easy to learn, fast to code, ready for production

Image by the Author

End to End Sample project using the above tools:

The project flow is as follows:

Flow for Machine Learning Model Deployment:

Develop the ML Model:

  • Data Collection
  • Data Preprocessing
  • Model Training
  • Model Evaluation
  • Model Export (e.g., a TensorFlow SavedModel or a PyTorch state_dict)

Streamlit App Development:

  • Write the app script using Streamlit that uses the ML model for inference
  • Test the app locally

Dockerize the Streamlit App:

  • Create a Dockerfile with all the necessary instructions
  • Build the Docker image
  • Test the Docker container locally

Push to a Docker Registry:

  • Push the built Docker image to a container registry (e.g., Docker Hub, Google Container Registry, etc.)

Infrastructure Setup with Terraform:

  • Write Terraform configurations to define and provide data center infrastructure using declarative configuration files
  • Initialize Terraform, apply configurations to provision the Google Kubernetes Engine (GKE) cluster and other required resources in GCP

Package Application with Helm:

  • Create a Helm chart for your Streamlit app that includes Kubernetes manifest templates and values
  • Package the Helm chart

Kubernetes Deployment with Helm:

  • Deploy your application to the Kubernetes cluster (e.g., GKE) using Helm
  • Helm will use the packaged chart to deploy and manage the Kubernetes resources

Continuous Integration & Continuous Deployment (CI/CD):

  • Use GitHub Actions to automate the model training, testing, Docker build, Terraform application, and Helm deployment
  • Configure GitHub Actions workflows and triggers

Monitor & Scale:

  • Monitor application and model performance using monitoring solutions (like Prometheus, Grafana)
  • Scale up/down based on traffic using Kubernetes auto-scaling or manual commands

1. Machine Learning Model:

import tensorflow as tf
import tensorflow_hub as hub

model_url = ""
model = tf.keras.Sequential([

def classify_image(image_path):
img = tf.keras.preprocessing.image.load_img(image_path, target_size=(224, 224))
img_array = tf.keras.preprocessing.image.img_to_array(img)
img_array = tf.expand_dims(img_array, 0)

predictions = model.predict(img_array)
top_prediction = tf.keras.applications.mobilenet_v2.decode_predictions(predictions.numpy())[0][0]
return top_prediction[1], top_prediction[2]

2. Streamlit App:

Python code (

import streamlit as st
from model import classify_image

st.title("Image Classifier")

uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "png", "jpeg"])
if uploaded_file:
st.image(uploaded_file, caption='Uploaded Image.', use_column_width=True)
label, probability = classify_image(uploaded_file)
st.write(f"Class: {label}, Confidence: {probability:.2f}%")

3. Docker:


FROM python:3.8-slim


COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

COPY . .

CMD ["streamlit", "run", ""]



Build and push to Docker Hub:

docker build -t username/image-classifier .
docker push username/image-classifier

4. Kubernetes & Helm:

Create a Helm chart for our deployment.

Chart Structure (simplified):

|-- templates/
| |-- deployment.yaml
| |-- service.yaml
|-- values.yaml
|-- Chart.yaml

In deployment.yaml and service.yaml, define the Kubernetes deployment and service structures, referencing the Docker image and ports accordingly.


This file defines a Kubernetes Deployment, which ensures that a certain number of pod replicas are running at any given time.

apiVersion: apps/v1
kind: Deployment
name: image-classifier-deployment
replicas: 2
app: image-classifier
app: image-classifier
- name: image-classifier-container
image: username/image-classifier:latest
- containerPort: 8501 # Streamlit's default port


apiVersion: v1
kind: Service
name: image-classifier-service
app: image-classifier
- protocol: TCP
port: 80
targetPort: 8501
type: LoadBalancer


replicaCount: 2

repository: username/image-classifier
tag: latest
pullPolicy: IfNotPresent

type: LoadBalancer
port: 80

This is a default configuration file for Helm charts. When you deploy a Helm chart, you can override these default values.


apiVersion: v2
name: image-classifier-chart
description: A Helm chart to deploy the image classifier app on Kubernetes
version: 0.1.0
appVersion: 1.0.0

5. GitHub Actions:

Set up a CI/CD pipeline that builds the Docker image and pushes it to Docker Hub whenever code is committed.


name: Build and Push Docker Image

- master

runs-on: ubuntu-latest

- name: Checkout code
uses: actions/checkout@v2

- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Build and Push Docker Image
run: |
docker build -t username/image-classifier .
docker push username/image-classifier

Once the GitHub Action successfully builds and pushes the Docker image, you can use Helm to deploy the chart to a Kubernetes cluster.

Deploying with Helm:

To deploy the Streamlit app using Helm:

Package the Helm chart:

helm package image-classifier-chart

Install the chart onto your Kubernetes cluster:

helm install image-classifier-release image-classifier-chart-0.1.0.tgz

Once the deployment is complete, you’ll get an external IP address from the LoadBalancer. Accessing this IP on a browser will take you to the Streamlit app.

Additonal Tools:Terraform(IAC):

Image by the Author

Introduction to Terraform:

Terraform is an open-source infrastructure-as-code (IAC) software tool developed by HashiCorp. It allows users to define and provision data center infrastructure using a declarative configuration language. With Terraform, you can manage and automate infrastructure across multiple cloud providers, making it an essential tool for modern cloud-based applications, including ML deployments.

Why Terraform for ML Deployment?

  • Immutable Infrastructure: Define your ML infrastructure once and deploy consistently across stages.
  • Provider Agnostic: Whether you use AWS, Google Cloud, Azure, or a combination, Terraform has got you covered.
  • Scalability: Easily scale ML resources up or down based on demand.
  • Version Controlled: Infrastructure is stored as code, making versioning and rollbacks seamless.

Setting Up Terraform for ML Environments

  • Install Terraform: Follow the official installation guide tailored for your OS.
  • Initialize a New Terraform Configuration: Use terraform init to begin a new project.
  • Configure Cloud Provider: Set up authentication for your chosen cloud provider(s).

Deploying ML Infrastructure using Terraform

  1. Define Infrastructure: Describe resources like VMs, storage, and networking required for your ML model in a .tf file.
  2. Plan the Deployment: Using terraform plan, review changes before they are applied.
  3. Apply the Changes: terraform apply will provision the defined resources.
  4. Integrate ML Components: Once infrastructure is ready, deploy your ML model, necessary services, and other components.

Continuous Integration and Continuous Deployment (CI/CD) with Terraform

  • Automate Workflow: Integrate Terraform with CI/CD tools like Jenkins, GitHub Actions, or GitLab CI.
  • Automated Testing: Ensure the integrity of your ML deployment by automating infrastructure testing.
  • Rollback Capabilities: With version-controlled infrastructure, rollbacks are smoother and more manageable.
  • Collaborate: Use Terraform Cloud or Terraform Enterprise for collaboration features and remote state management.

Best Practices and Tips

  • Modularize Configurations: Break down configurations into modules for better organization and reusability.
  • Secure Sensitive Data: Use secrets management tools and avoid hardcoding credentials.
  • Regularly Update: Ensure you’re always using the latest version of Terraform and provider plugins.
  • Document: Just as with code, commenting and documenting your Terraform configurations is crucial.


  • Initialize a New Terraform Working Directory:
terraform init
  • This command is used to initialize a working directory containing Terraform configuration files. It’s the first command that should be run after writing a new Terraform configuration.

Managing Infrastructure

  • Plan and Preview Infrastructure Changes:
terraform plan
  • This command lets you see what changes Terraform will apply to your infrastructure before it actually does anything.

Apply Infrastructure Changes:

terraform apply
  • This command applies the changes required to reach the desired state defined in your configuration.

Destroy Infrastructure

terraform destroy
  • Removes all resources created by your Terraform configuration. Be cautious with this command; it will literally tear down everything described in the Terraform configuration.

Inspecting State

  • Show Current State:
terraform show
  • Provides a readable version of the current infrastructure state.

Managing Modules:

  • Get Modules:
terraform get
  • Downloads and installs modules needed for the current configuration.

Workspace Management

Workspaces allow you to maintain multiple distinct states for the same configuration.

  • List Workspaces:
terraform workspace list
  • Select Workspace:
terraform workspace select [workspace_name]
  • Create New Workspace:
terraform workspace new [workspace_name]

Formatting and Validation:

  • Format Configuration:
terraform fmt
  • This command is used to rewrite Terraform configuration files in a canonical format and style.
  • Validate Configuration:
terraform validate
  • Validates the configuration files in a directory, referring only to the configuration and not accessing any remote services like providers.

Importing Existing Infrastructure

  • Import Resources:
terraform import [address] [resource_id]
  • Imports existing infrastructure into your Terraform state. Useful for getting pre-existing infrastructure managed under Terraform.

Output Values:

  • Show Outputs:
terraform output
  • Displays the output values from your last apply.


Remember, Terraform configurations are written in files with the .tf extension. When running commands like plan and apply, Terraform uses the configuration files in the current directory.

Check out my article about terraform if you want to learn more.

A Comprehensive Guide to MLOps: Infrastructure As Code(IaC)

GCP provisioning using Terraform


Image by the Author

Spinnaker is an open-source, multi-cloud continuous delivery platform that helps developers automate, manage, and monitor the deployment of applications. It was created by Netflix and is now backed by Google, making it a reliable choice for modern software delivery.

Why Spinnaker for ML?

  • Scalability: With ML models becoming increasingly complex and resource-demanding, Spinnaker’s cloud-native approach ensures seamless scaling.
  • Versioning: ML models often need frequent updates. Spinnaker allows for smooth versioning of deployed models.
  • Rollbacks: In case an ML model doesn’t perform as expected, Spinnaker provides easy rollback options.
  • Multi-cloud: If your ML deployments need to leverage resources from multiple cloud providers, Spinnaker has you covered.

Deploying an ML model using Spinnaker

Here’s a simplified process to get you started:

  1. Package your ML model: Your model, pre-trained weights, and inference code should be containerized using tools like Docker.
  2. Integrate with CI tools: Ensure your model containers are built automatically using CI tools like Jenkins or Travis CI.
  3. Create a Spinnaker Application: This is a logical grouping for your deployment pipelines.
  4. Define a Deployment Pipeline: Define stages like ‘Fetch the latest model’, ‘Deploy to staging’, ‘Run tests’, and ‘Deploy to production’.
  5. Automate: Trigger the deployment pipeline automatically every time there’s an update to your ML model.

Continuous delivery in ML with Spinnaker

  • Automate Model Testing: Integrate model validation tests in your deployment pipeline.
  • Blue/Green Deployments: Deploy new versions alongside the old, directing a subset of traffic to the new version. Useful for A/B testing of models.
  • Monitoring & Logging: Integrate with monitoring tools like Prometheus and Grafana to keep an eye on model performance and resource utilization.
  • Feedback Loop: Quickly iterate on model updates based on real-world feedback and performance metrics.

Some basic commands:

### Spinnaker Commands ###

# 1. Install `hal` (Halyard), the command-line tool for configuring and managing Spinnaker
curl -O
sudo bash
sudo update-hal

# 2. Choose cloud providers (e.g., AWS, GCP, Kubernetes)
hal config provider [provider name] enable

# 3. For Kubernetes (as an example cloud provider)
# Assuming you have a kubeconfig file already set up
hal config provider kubernetes account add my-k8s-account --provider-version v2 \
--kubeconfig-file ~/.kube/config

# 4. Set the deployment environment
hal config deploy edit --type distributed --account-name my-k8s-account

# 5. Choose storage for Spinnaker's persistent data
# Example with GCS (Google Cloud Storage)
hal config storage gcs edit --project [YOUR_PROJECT_ID] --bucket-location [BUCKET_LOCATION] --json-path [PATH_TO_SERVICE_ACCOUNT_JSON]
hal config storage edit --type gcs

# 6. Choose the version of Spinnaker you want to run
hal version list
hal config version edit --version [desired version]

# 7. Deploy Spinnaker using Halyard
hal deploy apply

# 8. Connect to the Spinnaker UI
# Assuming you are using Kubernetes, set up port forwarding:
kubectl port-forward -n spinnaker svc/spin-deck 9000:9000 & kubectl port-forward -n spinnaker svc/spin-gate 8084:8084

# Now, you can access Spinnaker at http://localhost:9000

# 9. Update Spinnaker (after choosing a new version with `hal version edit`)
hal deploy apply

# 10. Backup Halyard's configuration
tar -czf hal-backup.tgz ~/.hal/

Check out the documentation


Multi-cloud continuous delivery for the enterprise


Image by the Author

Crossplane is an open-source infrastructure-as-code (IAC) platform that extends Kubernetes to include cloud infrastructure orchestration. It integrates directly with Kubernetes, allowing you to declare, automate, and manage external infrastructure using familiar K8s tools and practices.

Crossplane’s Role in ML Deployment:

  • Unified Workflow: With Crossplane, manage both Kubernetes-native and cloud-native resources using kubectl.
  • Provider Diversity: Support for multiple cloud providers ensures that ML deployments can be provider-agnostic.
  • Dynamic Scaling: ML resources can be scaled based on demand, fully automated.
  • Secure Configuration: Manage sensitive configuration and secrets seamlessly.

Check out cross-plane documentation:

Crossplane Docs · v1.13 · Getting Started

Hands-On Want a hands-on example? Follow a Crossplane Quickstart for your cloud provider. AWS quickstart Azure…


Image by the Author
  • Configuration Management Tool: Puppet is a configuration management tool that automates the provisioning and management of servers.
  • Declarative Language: Users define the desired state of the infrastructure (what you want the system to look like, what software packages it should have, etc.) using Puppet’s declarative language, and Puppet will enforce this desired state.
  • Infrastructure as Code: With Puppet, infrastructure is managed as code. This allows for versioning, peer review, and automated testing, just like any other software codebase.
  • Idempotency: One of the key features of Puppet is its idempotent nature — which means it ensures that the end state remains consistent with each run, irrespective of the initial conditions. If the desired state is already met, Puppet won’t make any changes.
  • Agent/Server Model: Typically, Puppet follows a master-agent setup. The master contains the configurations defined by Puppet code, and agents periodically check in with the master to fetch configuration instructions.
  • Modules and Forge: Modules are reusable, shareable chunks of code that perform specific tasks in Puppet. Puppet Forge is a marketplace where community members can share these modules.
  • Flexibility: Puppet can manage a diverse range of infrastructure, from bare metal to containers, and across different platforms and cloud environments.
  • Reporting: Puppet provides detailed reports that show what changes have been made and who made them.
  • Integrations: Puppet integrates well with other DevOps tools, enabling users to build complete Continuous Integration/Continuous Deployment (CI/CD) pipelines.
  • Open Source and Enterprise Versions: Puppet is available in both open source and enterprise versions. The enterprise version provides additional features, including a graphical interface, analytics, and professional support.

Check out puppet documentation:

Docs | Puppet

Explore Puppet Product Documentation. Puppet automates away the challenges, complexity, and risk of securing and…


Deploying machine learning models seamlessly and efficiently requires a holistic approach, combining the power of various tools tailored for different tasks. From crafting interactive front-end applications using Streamlit, Gradio, Flask, or FastAPI to containerizing with Docker, orchestrating with Kubernetes and Helm, and automating infrastructure with Terraform, the contemporary ML deployment landscape is rich and diverse. Leveraging these tools not only ensures robust and scalable deployments but also accelerates the journey from model development to real-world impact. As the tech ecosystem evolves, these integrated tools pave the way for an era of streamlined ML deployments.


  1. Docker:

2. Kubernetes:

3. Helm:

4. Streamlit:

  • Documentation: Streamlit official documentation
  • Book: Due to Streamlit being relatively new, there aren’t many dedicated books as of my last update in 2021. However, online blogs, tutorials, and the official documentation should suffice.

5. Gradio:

  • Documentation: Gradio official documentation
  • Gradio is a newer tool and might not have dedicated books. The official documentation and online resources can be the best guide.

6. Flask:

7. FastAPI:

8. Terraform:

9. GitHub Actions:

Leave a Reply

Your email address will not be published. Required fields are marked *