AI-powered demand prediction & business intelligence dashboard
Built with Python, Flask, scikit-learn, and Chart.js
A modular Sales/Demand Forecasting System that uses historical business data (Superstore dataset) to predict future sales and present results through an interactive, business-friendly dashboard.
The system helps businesses:
- 📦 Plan inventory based on predicted demand
- 💰 Manage cash flow with revenue projections
- 👥 Prepare staffing for peak seasons
- 📉 Avoid overstocking or losses through trend analysis
The project follows a modular architecture with separate frontend and backend directories:
FUTURE_ML_01/
├── backend/ # Python ML Pipeline + REST API
│ ├── app.py # Flask API server (4 endpoints)
│ ├── data_preprocessing.py # Data cleaning & feature engineering
│ ├── model.py # Linear Regression model & forecasting
│ ├── requirements.txt # Python dependencies
│ └── model_artifacts/ # Serialized model (auto-generated)
│
├── frontend/ # Interactive Dashboard (SPA)
│ ├── index.html # Multi-page dashboard layout
│ ├── styles.css # Premium dark-mode stylesheet
│ └── app.js # Chart.js visualizations & page router
│
├── Sample - Superstore.csv # Dataset (9,994 transactions)
├── vercel.json # Vercel deployment config
└── README.md
| Page | Description |
|---|---|
| Overview | 6 KPI cards (Sales, Profit, Orders, AOV, Margin, Items) + YoY Growth chart |
| Forecast | Historical vs. 12-month predicted sales line chart + detail table |
| Breakdown | Category, Region, Segment doughnuts + Top Sub-Categories bar chart |
| Seasonality | Monthly patterns with holiday highlighting + yearly comparison lines |
| Model | Linear Regression metrics (MAE, RMSE, MAPE, R²) + Actual vs Predicted plot |
- Data Preprocessing: Date parsing, aggregation, duplicate removal
- Feature Engineering: Lag features, rolling means, cyclical month encoding, holiday flags
- Model: Linear Regression with time-ordered 80/20 train/test split
- Forecasting: Iterative 12-month ahead predictions with lag propagation
- Premium dark mode with glassmorphism effects
- Micro-animations (KPI counter animation, page transitions, hover effects)
- Fully responsive (desktop, tablet, mobile)
- Google Fonts (Inter) for modern typography
- Python 3.8+
- pip
# Clone the repository
git clone https://github.com/Ayon-coder/FUTURE_ML_01.git
cd FUTURE_ML_01
# Install backend dependencies
cd backend
pip install -r requirements.txt# Terminal 1 — Start the backend API
cd backend
python app.py
# → API running at http://127.0.0.1:5000
# Terminal 2 — Serve the frontend
cd frontend
python -m http.server 8080
# → Dashboard at http://127.0.0.1:8080Open http://127.0.0.1:8080 in your browser.
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/health |
Health check |
GET |
/api/forecast |
Historical + 12-month predicted sales |
GET |
/api/metrics |
Model evaluation metrics (MAE, RMSE, MAPE, R²) |
GET |
/api/insights |
KPIs, category/region/segment breakdowns, seasonality |
Sample - Superstore.csv — a widely used retail dataset containing:
- 9,994 transactions across 4 years (2014–2017)
- 21 columns: Order Date, Sales, Profit, Quantity, Category, Region, Segment, etc.
- 3 Categories: Furniture, Office Supplies, Technology
- 4 Regions: Central, East, South, West
- 3 Segments: Consumer, Corporate, Home Office
| Layer | Technology |
|---|---|
| Backend | Python, Flask, Flask-CORS |
| ML | scikit-learn (Linear Regression) |
| Data | pandas, NumPy |
| Frontend | HTML5, CSS3, JavaScript (ES6+) |
| Charts | Chart.js 4.4 |
| Fonts | Google Fonts (Inter) |
This project is licensed under the MIT License.