Skip to content

SUNILPOLIMERA/Prediction-of-Vehicle-Carbon-Emissions-Using-Machine-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚗 CO2 Emission Prediction Web App

This Flask-based web application predicts CO2 emissions of vehicles using Machine Learning models. It allows users to upload vehicle data, preview datasets, and select between Random Forest or Decision Tree models for prediction.

🔍 Features

  • 📊 Upload and preview vehicle datasets (CSV)
  • 🤖 Predict CO2 emissions using pre-trained ML models
  • 📈 Model performance visualization
  • 🔄 User-friendly interface with multiple pages

🧠 Models Used

  • RandomForestClassifier (loaded from co2_random.pkl)
  • DecisionTreeClassifier (loaded from co2_decision.pkl)

These models are pre-trained and include preprocessing logic for categorical and numerical variables.

📁 Project Structure

project/
│
├── app.py                                 # Main Flask app
├── templates/
│   ├── index.html
│   ├── login.html
│   ├── upload.html
│   ├── preview.html
│   ├── prediction.html
│   ├── performance.html
│   └── chart.html
├── co2_random.pkl                         # Random Forest model (add your file)
├── co2_decision.pkl                       # Decision Tree model (add your file)
└── static/                                # (Optional) For CSS, JS, images

🔧 Installation & Run

  1. Clone the repo

    git clone https://github.com/YOUR_USERNAME/your-repo-name.git
    cd your-repo-name
  2. Install dependencies

    pip install flask pandas numpy
  3. Add models Place co2_random.pkl and co2_decision.pkl in the project root directory.

  4. Run the app

    python app.py
  5. Access in browser

    http://127.0.0.1:5000/
    

🖥️ Pages Overview

Route Description
/ Homepage
/login Login Page (static)
/upload Upload CSV File
/preview Preview uploaded dataset
/prediction Prediction form
/predict Prediction result from form input
/performance Performance visualization
/chart Charts / Additional analytics

📌 Notes

  • Make sure your input matches the expected format in the prediction form.
  • Both models require structured inputs and handle preprocessing internally.
  • Supports only .csv files for uploads.

🔮 Future Enhancements

  • 🌐 Deploy on Cloud Platforms – Host the app on Heroku, AWS, or Render for public access.
  • 📊 Interactive Dashboards – Add real-time data visualization with libraries like Plotly or Dash.
  • 🧹 Data Preprocessing Options – Allow users to clean or transform uploaded datasets before prediction.
  • 🔑 User Authentication – Implement signup/login with role-based access for better security.
  • 💾 Database Integration – Store uploaded datasets and prediction results using SQLite/PostgreSQL.
  • 📱 Responsive UI – Enhance front-end with Bootstrap or TailwindCSS for better mobile compatibility.
  • 🧠 More Models – Add support for XGBoost, LightGBM, or Neural Networks with model comparison.
  • ⚙️ Hyperparameter Tuning – Let users experiment with tuning ML models from the UI.
  • 📤 Export Results – Provide options to download predictions as CSV or Excel reports.
  • 📈 Model Training from UI – Allow users to upload datasets and train their own models inside the app.

🤝 Contributions

Feel free to fork the repo, improve features, or add enhancements via pull requests.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages