This project includes a Python script that uses the Climatiq API to calculate CO2 emissions for three types of vehicles over a specific distance. The vehicles considered are light, mid-range and heavy-duty vehicles. This project was commissioned by marllm.io
Deployed app link - https://car-co2-emissions-calculator-3eyzgf3dcv7jfdqmans8al.streamlit.app/
-
app.py
: This script creates an interactive Streamlit web app for estimating CO2 emissions. It lets the user input a number and returns a table of data and bar chart displaying this data. You can download this data via theDownload data as CSV
button underneath the chart -
output_all_data.py
: This script returns unfiltered emission data. -
output_sorted_data.py
: This script simply returns a neat table and bar graph.
To run these scripts, you will need Python and the requests
library installed. You'll also need an API key from Climatiq API
- Python
requests
library (pip install requests
)- Climatiq API Key
- Streamlit (
pip install streamlit
)
- Clone this repository.
- Install
requests
andStreamlit
using pip - Insert your Climatiq API key into the script
- Comment Line 1 in
output_all_data.py
,output_sorted_data.py
andapp.py
once you've inserted your Climatiq API key. - To run the streamlit app, run
streamlit run app.py
in the terminal for app.py. This will start a local server. Open the URL provided in the terminal to interact with your app.