Skip to content

varunchach/docker_ml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker for Data Science — Iris classification demo

Overview This tiny demo shows how to train an Iris classifier with scikit-learn, serve it with Streamlit for an interactive UI, and package it in Docker.

Files

  • src/train.py — trains a RandomForest and saves models/model.joblib.
  • src/app.py — Flask inference API with /predict and /health.
  • requirements.txt — Python dependencies.
  • Dockerfile — container image.

Quickstart (PowerShell on Windows)

  1. Create a Python venv and install dependencies (optional but recommended): python -m venv .venv ..venv\Scripts\Activate.ps1 pip install -r requirements.txt

  2. Train the model locally: python .\src\train.py

    After this you should have models\model.joblib.

  3. Build the Docker image: docker build -t iris-demo:latest .

  4. Run the container (recommended — bind to localhost so it's only reachable from your machine): docker run --rm -p 127.0.0.1:8501:8501 iris-demo:latest

    Then open in your browser: http://127.0.0.1:8501

    If you need to expose to the LAN (other devices on your network), use: docker run --rm -p 8501:8501 iris-demo:latest and open: http://:8501

Notes

  • To train inside Docker during build, add RUN python src/train.py to the Dockerfile and copy only src/ before that. This makes builds longer but is reproducible.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •