File size: 2,806 Bytes
22032c4
 
 
 
 
 
 
 
 
a1099a1
22032c4
a1099a1
22032c4
 
a1099a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22032c4
a1099a1
 
22032c4
 
a1099a1
 
22032c4
 
 
 
a1099a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: Inference Studio
emoji: 
colorFrom: red
colorTo: blue
sdk: docker
app_port: 7860
---

# ML Lab Assignment | Inference Studio

A premium, highly asynchronous web interface for machine learning model inference. This project serves as a comprehensive playground for testing and interpreting three distinct predictive models using **FastAPI**, **Jinja2**, and **SHAP** explainability.

## Features

- **Multi-Model Support**: Seamlessly switch between Consumer Trends, F1 Pit Strategy, and Sleep Health models.
- **Deep Interpretability**: Real-time **SHAP Diverging Charts** visualizing feature contributions.
- **Neural UI/UX**: Cyber-Industrial aesthetic with glassmorphism, fluid animations, and dark-mode optimization.
- **Data Injection**: "Auto-Inject" feature to quickly test models with real samples from the datasets.
- **HuggingFace Ready**: Fully containerized and optimized for deployment on HF Spaces.

## Project Structure

```text
.
├── dataset/                # Source CSV files from Kaggle
├── inference/
│   ├── app.py              # FastAPI Backend with SHAP Integration
│   └── template/           # Frontend (HTML, CSS, JS)
├── notebooks/              # Jupyter Notebooks for model training
├── outputs/                # Trained model artifacts (.joblib) and performance metrics
├── Dockerfile              # Multi-stage Docker configuration
├── .gitattributes          # LFS tracking for datasets and models
```

## Datasets & Models

| Model | Target | Dataset Source |
|-------|--------|----------------|
| **Consumer Trends** | Category Prediction | [Kaggle Link](https://www.kaggle.com/datasets/minahilfatima12328/consumer-shopping-trends-analysis) |
| **F1 Pit Strategy** | Pit Stop Next Lap | [Kaggle Link](https://www.kaggle.com/datasets/aadigupta1601/f1-strategy-dataset-pit-stop-prediction) |
| **Sleep Health** | Sleep Disorder Classifier | [Kaggle Link](https://www.kaggle.com/datasets/mohankrishnathalla/sleep-health-and-daily-performance-dataset) |

## Local Development
1. **Setup Environment**:
   ```bash
   python -m venv .venv
   source .venv/bin/activate  # or .venv\Scripts\activate on Windows
   pip install -r requirements.txt
   ```

2. **Run Server**:
   ```bash
   uvicorn inference.app:app --reload
   ```

3. **Access UI**: Open `http://127.0.0.1:8000`


## Technology Stack
- **Backend**: FastAPI (Python 3.11)
- **Explainability**: SHAP (SHapley Additive exPlanations)
- **Frontend**: Vanilla CSS, JS (ES6+), Jinja2 Templates
- **Containerization**: Docker
- **ML Engine**: Scikit-Learn, XGBoost, Joblib

## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---
*Created as part of the B.Tech Semester 04 Machine Learning Lab Assignment.*