A single FastAPI application that serves four separate machine learning models behind one API, with a landing page that routes to each tool. Built to bring together the models trained in this ML/DL series into one deployable service.
| Tool | Endpoint | Model |
|---|---|---|
| Fraud Detection | POST /predict/fraud |
Isolation Forest on transaction features |
| Real Estate Price | POST /predict/price |
Regression on California housing features |
| Image Classifier | POST /classify/image |
Fashion-MNIST classifier, image upload |
| Sentiment Analysis | POST /predict/sentiment |
LinearSVC + TF-IDF on tweet text |
Each model was trained separately (see their own repos: credit-card-fraud-detection, california-realEstate-simulator, vision-upload-service, realtime-sentiment-fastapi). This hub loads all four .joblib pipelines and exposes them under one FastAPI app and one frontend.
POST /predict/fraud
{ "Time": 5000, "Amount": 120.50, "v_features": [/* 28 numbers, V1 to V28 */] }→ { "is_fraud": false, "risk_score": 12.4 }
POST /predict/price
{
"median_income": 8.3, "house_age": 20, "avg_rooms": 6.0, "avg_bedrooms": 1.0,
"population": 1200, "avg_occupancy": 3.0, "latitude": 34.05, "longitude": -118.25
}→ { "predicted_price": 452600.0 }
POST /classify/image — multipart form upload, field name file
→ { "predicted_class": "Sneaker" }
POST /predict/sentiment
{ "text": "The dish tasted awful, definitely don't recommend the place." }→ { "text": "...", "sentiment": "Negative", "confidence": 0.048 }
multi-model-hub/
├── main.py
├── models/
│ ├── fraud_pipeline.joblib
│ ├── california_realEstate_pipeline.joblib
│ ├── vision_upload_pipeline.joblib
│ └── sentiment_pipe.joblib
├── index.html
├── requirements.txt
└── hub_smoke_test.ipynb
git clone https://github.com/varun-aahil/multi-model-hub.git
cd multi-model-hub
mkdir models
pip install -r requirements.txt
uvicorn main:app --reloadBefore starting the server for the first time, run hub_smoke_test.ipynb to confirm all four models load and predict correctly.
Open index.html in your browser, or use http://127.0.0.1:8000/docs to try each endpoint directly.
Python, FastAPI, scikit-learn, Pillow, NumPy, Pydantic, vanilla HTML/CSS/JS
- The fraud endpoint's risk-score formula is a rough placeholder; calibrate it against the training score distribution.
- No authentication; not meant for public deployment as-is.
- Each model has its own preprocessing baked into its pipeline; if you retrain any of them, confirm the input shape here still matches.
