Skip to content

In this step-by-step tutorial, learn how to build, visualize, and deploy a Scikit-learn machine learning model using Streamlit for the UI, Docker for containerization, and Kubernetes (Minikube) for scalable deployment!

License

Notifications You must be signed in to change notification settings

iQuantC/Scikit-learn-Streamlit-Docker-Kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prototype Scikit-learn ML Model with Streamlit App

In this step-by-step tutorial, learn how to build, visualize, and deploy a Scikit-learn machine learning model using Streamlit for the UI, Docker for containerization, and Kubernetes (Minikube) for scalable deployment!

YouTube Link: https://youtu.be/Ska5_d63mLM?si=Xug9kxJoxheblrsu

Requirements

  1. Python
  2. Streamlit
  3. Docker
  4. DockerHub Account
  5. Kubernetes Cluster (Minikube)

Install Required Packages

sudo apt update && sudo apt upgrade -y
sudo apt install python3-pip -y

Create Python Virtual Environment & Activate it

python -m venv venv
source venv/bin/activate
pip3 install streamlit scikit-learn pandas matplotlib seaborn reportlab

Run Streamlit App

streamlit run app.py

On your browser

http://localhost:8501

or

http://PublicIP:8501

Build and Run the Docker Image Using the Dockerfile

docker build -t streamlit-ml-app:latest .
docker run -p 8501:8501 streamlit-ml-app:latest

On your browser

http://localhost:8501

Push Streamlit Docker Image to DockerHub

Go to your DockerHub account and create a Personal Access Token (PAT) - This will be your password -

docker login -u iquantc

Tag Your Local Docker Image

docker tag streamlit-ml-app:latest iquantc/streamlit-ml-app:latest

Push the Image to DockerHub

docker push iquantc/streamlit-ml-app:latest

Deploy Streamlit App Docker Image from DockerHub to Kubernetes

Review manifest files

Create Minikube cluster

minikube start --driver=docker

Deploy the Kubernetes Manifest Files

kubectl apply -f deployment.yaml
kubectl apply -f service.yaml

Check the Resources Created

kubectl get pods
kubectl get svc
minikube ip

Open in Browser

http://<minikube-ip>:30001

Clean up

minikube stop
minikube delete --all

About

In this step-by-step tutorial, learn how to build, visualize, and deploy a Scikit-learn machine learning model using Streamlit for the UI, Docker for containerization, and Kubernetes (Minikube) for scalable deployment!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published