Spaces:
Sleeping
Sleeping
feat: add MIT license, automate HuggingFace synchronization, and update project documentation
Browse files- .github/workflows/sync_to_hf.yml +35 -0
- LICENSE +21 -0
- README.md +52 -22
.github/workflows/sync_to_hf.yml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Sync to Hugging Face Spaces
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [main]
|
| 6 |
+
workflow_dispatch:
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
sync-to-hub:
|
| 10 |
+
runs-on: ubuntu-latest
|
| 11 |
+
steps:
|
| 12 |
+
- name: Checkout Repository
|
| 13 |
+
uses: actions/checkout@v4
|
| 14 |
+
with:
|
| 15 |
+
fetch-depth: 0
|
| 16 |
+
lfs: true
|
| 17 |
+
|
| 18 |
+
- name: Install Git LFS
|
| 19 |
+
run: git lfs install
|
| 20 |
+
|
| 21 |
+
- name: Push to Hugging Face
|
| 22 |
+
env:
|
| 23 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 24 |
+
run: |
|
| 25 |
+
# Configure Git
|
| 26 |
+
git config --global user.email "actions@github.com"
|
| 27 |
+
git config --global user.name "GitHub Actions"
|
| 28 |
+
|
| 29 |
+
# Remove GitHub-specific workflows to keep HF clean
|
| 30 |
+
rm -rf .github
|
| 31 |
+
git add .
|
| 32 |
+
git commit -m "chore: sync to huggingface (clean)" || echo "No changes to commit"
|
| 33 |
+
|
| 34 |
+
# Force push to HuggingFace Spaces
|
| 35 |
+
git push --force https://0xarchit:$HF_TOKEN@huggingface.co/spaces/0xarchit/ml-assignment main
|
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 Archit Jain
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
CHANGED
|
@@ -7,35 +7,65 @@ sdk: docker
|
|
| 7 |
app_port: 7860
|
| 8 |
---
|
| 9 |
|
| 10 |
-
# Inference Studio
|
| 11 |
|
| 12 |
-
A premium, highly asynchronous web interface for machine learning model inference
|
| 13 |
|
| 14 |
## Features
|
| 15 |
-
|
| 16 |
-
- **
|
| 17 |
-
- **
|
| 18 |
-
- **
|
| 19 |
-
- **
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
```bash
|
|
|
|
|
|
|
| 24 |
pip install -r requirements.txt
|
| 25 |
```
|
| 26 |
-
|
|
|
|
| 27 |
```bash
|
| 28 |
uvicorn inference.app:app --reload
|
| 29 |
```
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
-
|
| 39 |
-
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
app_port: 7860
|
| 8 |
---
|
| 9 |
|
| 10 |
+
# ML Lab Assignment | Inference Studio
|
| 11 |
|
| 12 |
+
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.
|
| 13 |
|
| 14 |
## Features
|
| 15 |
+
|
| 16 |
+
- **Multi-Model Support**: Seamlessly switch between Consumer Trends, F1 Pit Strategy, and Sleep Health models.
|
| 17 |
+
- **Deep Interpretability**: Real-time **SHAP Diverging Charts** visualizing feature contributions.
|
| 18 |
+
- **Neural UI/UX**: Cyber-Industrial aesthetic with glassmorphism, fluid animations, and dark-mode optimization.
|
| 19 |
+
- **Data Injection**: "Auto-Inject" feature to quickly test models with real samples from the datasets.
|
| 20 |
+
- **HuggingFace Ready**: Fully containerized and optimized for deployment on HF Spaces.
|
| 21 |
+
|
| 22 |
+
## Project Structure
|
| 23 |
+
|
| 24 |
+
```text
|
| 25 |
+
.
|
| 26 |
+
├── dataset/ # Source CSV files from Kaggle
|
| 27 |
+
├── inference/
|
| 28 |
+
│ ├── app.py # FastAPI Backend with SHAP Integration
|
| 29 |
+
│ └── template/ # Frontend (HTML, CSS, JS)
|
| 30 |
+
├── notebooks/ # Jupyter Notebooks for model training
|
| 31 |
+
├── outputs/ # Trained model artifacts (.joblib) and performance metrics
|
| 32 |
+
├── Dockerfile # Multi-stage Docker configuration
|
| 33 |
+
├── .gitattributes # LFS tracking for datasets and models
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
## Datasets & Models
|
| 37 |
+
|
| 38 |
+
| Model | Target | Dataset Source |
|
| 39 |
+
|-------|--------|----------------|
|
| 40 |
+
| **Consumer Trends** | Category Prediction | [Kaggle Link](https://www.kaggle.com/datasets/minahilfatima12328/consumer-shopping-trends-analysis) |
|
| 41 |
+
| **F1 Pit Strategy** | Pit Stop Next Lap | [Kaggle Link](https://www.kaggle.com/datasets/aadigupta1601/f1-strategy-dataset-pit-stop-prediction) |
|
| 42 |
+
| **Sleep Health** | Sleep Disorder Classifier | [Kaggle Link](https://www.kaggle.com/datasets/mohankrishnathalla/sleep-health-and-daily-performance-dataset) |
|
| 43 |
+
|
| 44 |
+
## Local Development
|
| 45 |
+
1. **Setup Environment**:
|
| 46 |
```bash
|
| 47 |
+
python -m venv .venv
|
| 48 |
+
source .venv/bin/activate # or .venv\Scripts\activate on Windows
|
| 49 |
pip install -r requirements.txt
|
| 50 |
```
|
| 51 |
+
|
| 52 |
+
2. **Run Server**:
|
| 53 |
```bash
|
| 54 |
uvicorn inference.app:app --reload
|
| 55 |
```
|
| 56 |
|
| 57 |
+
3. **Access UI**: Open `http://127.0.0.1:8000`
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
## Technology Stack
|
| 61 |
+
- **Backend**: FastAPI (Python 3.11)
|
| 62 |
+
- **Explainability**: SHAP (SHapley Additive exPlanations)
|
| 63 |
+
- **Frontend**: Vanilla CSS, JS (ES6+), Jinja2 Templates
|
| 64 |
+
- **Containerization**: Docker
|
| 65 |
+
- **ML Engine**: Scikit-Learn, XGBoost, Joblib
|
| 66 |
+
|
| 67 |
+
## License
|
| 68 |
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
*Created as part of the B.Tech Semester 04 Machine Learning Lab Assignment.*
|