Flask web app for predicting Algerian forest fire weather index using machine learning
# Flask ML Deployment - Algerian Forest Fires Prediction
A Flask web application to deploy a machine learning model for predicting Algerian forest fire weather indices.
## Project Structure
```
Flask_App/
├── app.py # Main Flask application
├── config.py # Configuration settings
├── export_model.py # Script to export trained models
├── requirements.txt # Python dependencies
├── Procfile # Heroku deployment configuration
├── .gitignore # Git ignore file
├── templates/
│ └── index.html # Main web interface
├── static/
│ └── css/
│ └── style.css # Styling
└── models/ # Directory for trained models (*.pkl files)
├── scaler.pkl # Fitted StandardScaler
└── lasso_cv_model.pkl # Trained LassoCV model
```
## Features
- **Web Interface**: User-friendly form to input forest fire features
- **Real-time Predictions**: Get FWI (Fire Weather Index) predictions instantly
- **API Endpoints**: RESTful API for programmatic predictions
- **Model Deployment**: Ready for Heroku, Docker, or other cloud platforms
## Installation
### 1. Create Virtual Environment
```bash
# Windows
python -m venv venv
venv\Scripts\activate
# macOS/Linux
python3 -m venv venv
source venv/bin/activate
```
### 2. Install Dependencies
```bash
pip install -r requirements.txt
```
### 3. Prepare Models
First, train your model in the Jupyter notebook and export it:
```python
# In your notebook after training
from export_model import export_models
export_models(lasso_cv, scaler)
```
This will create:
- `models/scaler.pkl` - Fitted StandardScaler
- `models/lasso_cv_model.pkl` - Trained model
## Running the Application
### Local Development
```bash
python app.py
```
Visit: `
localhost`
### Production (Heroku)
```bash
# Install Heroku CLI
# Login to Heroku
heroku login
# Create app
heroku create your-app-name
# Deploy
git push heroku main
# View logs
heroku logs --tail
```
### D …