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.
- 📊 Upload and preview vehicle datasets (CSV)
- 🤖 Predict CO2 emissions using pre-trained ML models
- 📈 Model performance visualization
- 🔄 User-friendly interface with multiple pages
RandomForestClassifier(loaded fromco2_random.pkl)DecisionTreeClassifier(loaded fromco2_decision.pkl)
These models are pre-trained and include preprocessing logic for categorical and numerical variables.
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
-
Clone the repo
git clone https://github.com/YOUR_USERNAME/your-repo-name.git cd your-repo-name -
Install dependencies
pip install flask pandas numpy
-
Add models Place
co2_random.pklandco2_decision.pklin the project root directory. -
Run the app
python app.py
-
Access in browser
http://127.0.0.1:5000/
| 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 |
- Make sure your input matches the expected format in the prediction form.
- Both models require structured inputs and handle preprocessing internally.
- Supports only
.csvfiles for uploads.
- 🌐 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.
Feel free to fork the repo, improve features, or add enhancements via pull requests.