Penguin Explorer - Full-stack ML Demo

MLOps
Full-stack
R
Python
Docker
Complete ML architecture: from model to API, with R and Python

Context & Problem

Technical question: How to deploy an ML model end-to-end with modern architecture?

This project demonstrates a complete ML architecture using the famous Palmer Penguins dataset. The goal is not the model itself (simple linear regression), but the deployment infrastructure.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   DuckDB    │────▢│  scikit-    │────▢│   Vetiver   β”‚
β”‚   (Data)    β”‚     β”‚   learn     β”‚     β”‚  (Registry) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                               β”‚
                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                         β–Ό                     β–Ό                     β–Ό
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚   FastAPI   β”‚     β”‚   Shiny     β”‚     β”‚   Shiny     β”‚
                  β”‚    (API)    β”‚     β”‚  (Python)   β”‚     β”‚    (R)      β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Architecture Highlights

  1. Model Registry with Vetiver and pins (version management)
  2. Auto-generated API with OpenAPI documentation
  3. Dual frontends: Shiny Python AND Shiny R
  4. Complete containerization with Docker Compose
  5. CI/CD with GitHub Actions

Implementation

Model Training & Registry

Using Vetiver to create a versioned model that auto-generates an API.

Docker Compose Deployment

Three services deployed: - API (FastAPI via Vetiver): http://localhost:8080/docs - Frontend Python (Shiny): http://localhost:8000 - Frontend R (Shiny): http://localhost:3838

CI/CD with GitHub Actions

Automated deployment on push to main branch, publishing documentation to gh-pages.

Technologies

Component Technology
Data DuckDB, palmerpenguins
ML scikit-learn
Model Registry Vetiver, pins
API FastAPI, Uvicorn
Frontend Python Shiny for Python
Frontend R Shiny
Containerization Docker, Docker Compose
CI/CD GitHub Actions
Documentation Quarto

Learnings

This project illustrates MLOps best practices:

  1. Separation of concerns: Model, API, Frontend distinct
  2. Model Registry: Model versioning with Vetiver
  3. API-first: Model exposed via standard API
  4. Multi-language: R and Python coexist harmoniously
  5. Containerization: Reproducible environments with Docker
  6. CI/CD: Automated deployment with GitHub Actions

← Back to Portfolio ML | GitHub