Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 

Repository files navigation

MLOps API A production-ready MLOps API for serving machine learning predictions with automated data pipelines and experiment tracking.

πŸ“Œ Overview This project provides a REST API to serve ML model predictions, automating the full pipeline from raw data ingestion to model inference. Experiment tracking and model versioning are handled via MLflow, making it easy to compare runs and deploy the best-performing model.

✨ Features

⚑ FastAPI β€” high-performance REST endpoints for real-time predictions πŸ” Automated Data Pipeline β€” handles preprocessing and feature engineering automatically πŸ§ͺ MLflow Tracking β€” logs experiments, parameters, metrics, and model versions πŸ€– Scikit-learn Models β€” trained, versioned, and served via API πŸ“Š Prediction Endpoint β€” send raw input, get back predictions instantly

πŸ› οΈ Tech Stack ToolPurposeFastAPIREST API frameworkScikit-learnML model training & inferenceMLflowExperiment tracking & model registryUvicornASGI serverPandas / NumPyData pipeline & preprocessing

πŸ“ Project Structure mlops-api/ β”‚ β”œβ”€β”€ app/ β”‚ β”œβ”€β”€ main.py # FastAPI app & routes β”‚ β”œβ”€β”€ model.py # Model loading & prediction logic β”‚ └── pipeline.py # Data preprocessing pipeline β”‚ β”œβ”€β”€ mlflow/ β”‚ └── experiments/ # MLflow tracked runs β”‚ β”œβ”€β”€ models/ β”‚ └── model.pkl # Trained scikit-learn model β”‚ β”œβ”€β”€ requirements.txt └── README.md

βš™οΈ Getting Started

  1. Clone the repository bashgit clone https://github.com/yuvrajrajput/mlops-api.git cd mlops-api
  2. Install dependencies bashpip install -r requirements.txt
  3. Start the API bashuvicorn app.main:app --reload
  4. Launch MLflow UI bashmlflow ui Open http://localhost:5000 to view experiments.

πŸ“‘ API Usage Predict Endpoint POST /predict json// Request { "feature_1": 5.1, "feature_2": 3.5, "feature_3": 1.4 }

// Response { "prediction": 1, "confidence": 0.94 } Health Check GET /health json{ "status": "ok" }

πŸ“ˆ MLflow Experiment Tracking All training runs are tracked with:

Model parameters (e.g. n_estimators, max_depth) Metrics (accuracy, F1, AUC) Artifacts (trained model, confusion matrix)

To register the best model: bashmlflow models serve -m "models:/BestModel/Production" --port 1234

About

MLOps API A production-ready MLOps API for serving machine learning predictions with automated data pipelines and experiment tracking.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages