Machine learning web app to predict the Fire Weather Index (FWI) for Algerian forest fire datasets — built with Flask, Ridge/Lasso/ElasticNet/Linear regression models, and a fire-themed UI.
# 🔥 FWI Predictor
Machine-learning powered Fire Weather Index (FWI) prediction web app built with Flask.
## Project Structure
```
fwi_app/
├── app.py # Flask application
├── wsgi.py # Gunicorn entry point
├── requirements.txt # Python dependencies
├── Procfile # Heroku / Railway / Render
├── Models/
│ ├── ridge_model.pkl # Trained Ridge Regression model
│ └── scaler.pkl # Fitted StandardScaler
└── templates/
├── index.html # Landing page
└── home.html # Prediction form + results
```
## Run Locally
```bash
pip install -r requirements.txt
python app.py
# →
localhost
```
## Deploy
### Render (free tier)
1. Push to GitHub
2. New Web Service → connect repo
3. Build: `pip install -r requirements.txt`
4. Start: `gunicorn wsgi:application`
### Railway
```bash
railway init
railway up
```
### Heroku
```bash
heroku create fwi-predictor
git push heroku main
```
## REST API
POST `/api/predict` with JSON body:
```json
{
"Temperature": 29,
"RH": 57,
"Ws": 18,
"Rain": 0,
"FFMC": 85.9,
"DMC": 26.2,
"ISI": 5.1,
"Classes": 0,
"Region": 0
}
```
Response:
```json
{
"fwi": 42.15,
"risk_level": "High",
"description": "High fire potential. Avoid outdoor burning."
}
```
## FWI Risk Levels
| FWI Range | Level |
|-----------|-----------|
| < 15 | Low |
| 15 – 29 | Moderate |
| 30 – 44 | High |
| 45 – 64 | Very High |
| ≥ 65 | Extreme |