Skip to content

akincenk/MLServe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

MLServe

MLServe is a lightweight FastAPI app that allows you to serve and interact with a machine learning model using REST endpoints. It loads (or trains) a RandomForest model on the Iris dataset and makes predictions via a /predict API.

Features

  • Loads or trains an ML model (RandomForestClassifier)
  • Accepts feature input as JSON
  • Returns prediction from deployed model
  • Includes Swagger UI

Stack

  • FastAPI
  • scikit-learn
  • joblib
  • Docker (optional)

How to Run

pip install -r requirements.txt
uvicorn main:app --reload

Or with Docker

docker build -t mlserve .
docker run -p 8000:8000 mlserve

Example API Call

POST /predict
Content-Type: application/json

{
  "features": [5.1, 3.5, 1.4, 0.2]
}

Returns:

{
  "prediction": 0
}

© 2025

About

Serve ML models via FastAPI with real-time predictions from trained classifiers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published