Skip to content

Add ML Pipeline with FastAPI API Endpoints and Weights & Biases Integration#2

Merged
parthraninga merged 8 commits intoparthraninga:mainfrom
p1rth13:main
Jun 18, 2025
Merged

Add ML Pipeline with FastAPI API Endpoints and Weights & Biases Integration#2
parthraninga merged 8 commits intoparthraninga:mainfrom
p1rth13:main

Conversation

@p1rth13
Copy link
Copy Markdown
Contributor

@p1rth13 p1rth13 commented Jun 18, 2025

🚀 What’s New

This PR adds a complete machine learning pipeline for the Iris dataset with the following production-ready features:

  • 🧠 Model training using Scikit-learn
  • 🛠️ ML pipeline structure following best practices
  • 🎯 Experiment tracking via Weights & Biases (W&B)
  • 📊 Automatic confusion matrix visualization logged to W&B
  • 🌐 FastAPI endpoints (/predict) for real-time inference
  • 📂 Proper folder structure for models/, api/, and pipeline.py
  • 📝 Updated .gitignore, LICENSE, README.md, and requirements.txt

📦 Files Added/Modified

  • pipeline.py — Model training, evaluation, and W&B integration
  • api/main.py — FastAPI app with /predict endpoint
  • .gitignore — Added W&B logs, Python envs
  • requirements.txt — Includes wandb, fastapi, uvicorn, scikit-learn, matplotlib, seaborn
  • README.md — Setup, usage, and cURL test instructions
  • LICENSE — MIT License
  • PULL_REQUEST_TEMPLATE.md — This file

🧪 How to Test

  1. Create virtual environment:

    python -m venv venv
    source venv/bin/activate  # or venv\Scripts\activate on Windows
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the pipeline:

    python pipeline.py
  4. Start the FastAPI app:

    uvicorn api.main:app --reload
  5. Test the prediction endpoint:

    curl -X POST "http://127.0.0.1:8000/predict" \
         -H "Content-Type: application/json" \
         -d '{"features": [5.1, 3.5, 1.4, 0.2]}'

📌 Notes

  • W&B API key must be set via environment or CLI login
  • FastAPI runs on localhost:8000 by default
  • Confusion matrix visual is auto-logged to W&B dashboard

🧭 Related Issues or PRs

Closes #1 — Initial ML pipeline setup and deployment interface

@parthraninga parthraninga merged commit 48c096a into parthraninga:main Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants