# π₯ Algerian Forest Fire β FWI Predictor (Flask App)
End-to-end deployment of the Ridge Regression model trained on the Algerian Forest Fires dataset.
## Project Structure
```
flask_regression_app/
βββ app.py # Flask application (routes + API)
βββ requirements.txt
βββ models/
β βββ ridge.pkl # Trained Ridge Regression model
β βββ scaler.pkl # Fitted StandardScaler
β βββ dataset.csv # Original dataset (for EDA charts)
βββ templates/
βββ index.html # Full interactive frontend
```
## Setup & Run
```bash
# 1. Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 2. Install dependencies
pip install -r requirements.txt
# 3. Run the app
python app.py
```
Open
localhost in your browser.
## Features
| Section | Description |
|---------|-------------|
| **Predict** | Enter 9 weather/FWI inputs, get FWI prediction + risk label |
| **EDA** | 4 interactive charts: histogram, monthly trend, scatter, class dist |
| **Model** | Ridge coefficients, feature importances, model metadata |
## Input Features
| Feature | Description | Range |
|---------|-------------|-------|
| Temperature | Max temperature at noon (Β°C) | 22β42 |
| RH | Relative Humidity (%) | 21β90 |
| Ws | Wind Speed (km/h) | 6β29 |
| Rain | Total rain (mm) | 0β16.8 |
| FFMC | Fine Fuel Moisture Code | 28.6β92.5 |
| DMC | Duff Moisture Code | 1.1β65.9 |
| ISI | Initial Spread Index | 0β18.5 |
| Classes | Fire or Not Fire | 0 / 1 |
| Region | Bejaia or Sidi-Bel Abbes | 0 / 1 |
## API Endpoints
```
GET / β Main UI
POST /predict β JSON prediction { fwi, risk_label, risk_color }
GET /api/eda β EDA chart data
GET /api/model_info β Coefficients + model metadata
```
## FWI Risk Scale
| FWI Range | Risk Level |
|-----------|------------|
| 0β5 | Very Low |
| 5β10 | Low |
| 10β17 | Moderate |
| 17β24 | Hig β¦