The AQI Prediction Dashboard is a Streamlit-based web application designed to predict the Air Quality Index (AQI) for various cities in India using machine learning models. The app integrates real-time air pollution data from the OpenWeather API and leverages pre-trained models (Random Forest, XGBoost, Polynomial Regression, and Linear Regression) to provide accurate AQI predictions. The project is built with Python and includes data preprocessing, model training, and an interactive user interface.
- Predict AQI for cities like Delhi, Bengaluru, Hyderabad, Chennai, Lucknow, Mumbai, Patna, Gurugram, Jaipur, and Ahmedabad.
- Fetch real-time air quality data using the OpenWeather API.
- Use pre-trained machine learning models for AQI prediction.
- Options to manually enter pollutant levels or autofill with mean values.
- Clone the repository to your local machine:
git clone https://github.com/your-username/AQI_FINAL.git cd aqi_final
- Create a virtual environment (optional but recommended):
python -m venv venv
- Activate the virtual environment:
On Windows:
On macOS/Linux:
venv\Scripts\activate
source venv/bin/activate
- Install the required Python packages listed in requirements.txt:
pip install -r requirements.txt
- Create a .env file in the train/ directory.
- Add your OpenWeather API key to the .env file:
API_KEY=your_openweather_api_key_here
- Ensure the following files are present:
- train/training_dataset.csv: Contains the training data used to calculate mean pollutant levels.
- train/trained_models/: Contains the pre-trained model files (linear_regression_model.pkl, polynomial_regression_model.pkl, random_forest_model.pkl, xgboost_model.pkl).
- If any file is missing, copy it from the data_clean/ directory (e.g., dataset-final.csv can be used as training_dataset.csv after cleaning) or regenerate it using training_final.ipynb.
- Change to the train directory:
cd train
- Start the Streamlit application:
streamlit run app.py
- Open your web browser and go to the URL provided by Streamlit.
The app is deployed on Streamlit Community Cloud.

