|
import streamlit as st |
|
from streamlit_option_menu import option_menu |
|
|
|
|
|
st.set_page_config(layout="wide", page_title="Ecotiva Carbon Calculator", initial_sidebar_state="expanded") |
|
|
|
st.subheader("Leading Tomorrow's Climate Action Today") |
|
|
|
EMISSION_FACTORS = { |
|
"India": { |
|
"Transport": 0.14, |
|
"Electricity": 0.02, |
|
"Diet": 1.25, |
|
"Waste": 0.1 |
|
}, |
|
"UK": { |
|
"Transport": 0.12, |
|
"Electricity": 0.03, |
|
"Diet": 1.15, |
|
"Waste": 0.09 |
|
}, |
|
"Germany": { |
|
"Transport": 0.13, |
|
"Electricity": 0.02, |
|
"Diet": 1.20, |
|
"Waste": 0.1 |
|
}, |
|
"USA": { |
|
"Transport": 0.15, |
|
"Electricity": 0.025, |
|
"Diet": 1.35, |
|
"Waste": 0.12 |
|
}, |
|
"West_Africa": { |
|
"Transport": 0.18, |
|
"Electricity": 0.04, |
|
"Diet": 1.40, |
|
"Waste": 0.15 |
|
}, |
|
"East_Africa": { |
|
"Transport": 0.17, |
|
"Electricity": 0.035, |
|
"Diet": 1.38, |
|
"Waste": 0.14 |
|
}, |
|
"Central_Africa": { |
|
"Transport": 0.19, |
|
"Electricity": 0.038, |
|
"Diet": 1.45, |
|
"Waste": 0.16 |
|
}, |
|
"South_Africa": { |
|
"Transport": 0.16, |
|
"Electricity": 0.03, |
|
"Diet": 1.30, |
|
"Waste": 0.11 |
|
}, |
|
"North_Africa": { |
|
"Transport": 0.2, |
|
"Electricity": 0.036, |
|
"Diet": 1.48, |
|
"Waste": 0.17 |
|
} |
|
} |
|
|
|
st.sidebar.header("Your Carbbon Footprint") |
|
|
|
|
|
|
|
with st.sidebar: |
|
selected = option_menu( |
|
menu_title=None, |
|
options=["Home", "About US", "Products", "Solutions", "Company", "Emissions", "Scope 1-3" ], |
|
icons=["house", "book", "envelope"], |
|
menu_icon="cast", |
|
default_index=0, |
|
styles={ |
|
"container": {"pardding": "0!important", "background-color": ""}, |
|
"icon": {"color": "orange", "font-size": "25px"}, |
|
"nav-link":{ |
|
"font-size": "25px", |
|
"text-align": "left", |
|
"margin": "0px", |
|
"--hover-color": "#eee", |
|
}, |
|
"nav-link-selected": {"background-color": "green"}, |
|
} |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if selected == "Home": |
|
st.title(f"You have selected {selected}") |
|
if selected == "Projects": |
|
st.title(f"You have selected {selected}") |
|
if selected == "Contact": |
|
st.title(f"You have selected {selected}") |
|
|
|
|
|
st.title ("Ecotiva Carbon Accounting Software") |
|
|
|
|
|
st.subheader("Your Country") |
|
country = st.selectbox("Select", ['India','UK', 'USA', 'West_Africa', 'East_Africa', 'Central_Africa', 'South_Africa', 'North_Africa' ]) |
|
|
|
|
|
|
|
|
|
|
|
col1, col2 = st.columns(2) |
|
|
|
with col1: |
|
st.header('Scope 1') |
|
st.subheader('Daily commute distance(in km)') |
|
distance = st.number_input("Distance", 0, key="distance_input") |
|
|
|
|
|
st.subheader("Monthly Electricity Consumption") |
|
electricity = st.number_input("Electricity", 0, key='electricity_input') |
|
|
|
|
|
with col2: |
|
st.header('Scope 2') |
|
st.subheader("Waste Generated per Week (per Ton)") |
|
waste = st.slider("Waste", 0, key="waste_input") |
|
|
|
|
|
st.subheader("Number of Meals per day") |
|
meals = st.number_input("Meals", 0, key="meals_input") |
|
|
|
|
|
if distance > 0: |
|
distance = distance * 365 |
|
|
|
|
|
if electricity > 0: |
|
electricity = electricity * 12 |
|
|
|
if meals > 0: |
|
meal = meals * 365 |
|
|
|
|
|
if waste > 0: |
|
waste = waste * 52 |
|
|
|
|
|
|
|
transportation_emissions = EMISSION_FACTORS[country]['Transport'] * distance |
|
electricity_emissions = EMISSION_FACTORS[country]['Electricity'] * electricity |
|
diet_emissions = EMISSION_FACTORS[country]['Diet'] * meals |
|
waste_emissions = EMISSION_FACTORS[country]['Waste'] * waste |
|
|
|
|
|
transportation_emissions = round(transportation_emissions / 1000, 2) |
|
electricity_emissions = round(electricity_emissions / 1000, 2) |
|
diet_emissions = round(diet_emissions / 1000, 2) |
|
waste_emissions = round(waste_emissions / 1000, 2) |
|
|
|
|
|
|
|
total_emissions = round( |
|
transportation_emissions + electricity_emissions + diet_emissions + waste_emissions, 2 |
|
) |
|
|
|
if st.button("Calculate Emissions"): |
|
|
|
|
|
st.header("Results") |
|
|
|
col3, col4 = st.columns(2) |
|
|
|
|
|
with col3: |
|
st.subheader('Carbon Emission by Categories') |
|
st.info(f" Transportation: {transportation_emissions} tonnes C02 per year") |
|
st.info(f" Electricity: {electricity_emissions} tonnes C02 per year") |
|
st.info(f" Diet: {diet_emissions} tonnes C02 per year") |
|
st.info(f" Waste: {waste_emissions} tonnes C02 per year") |
|
|
|
with col4: |
|
st.subheader("Total Carbon Footprint") |
|
st.info(f" Your total carbon footprint is: {total_emissions} tonnes C02 per year") |
|
st.warning("In 2021, C02 emissions per capita for Ghana was 1.9 tonnes. Between 2000 and 2021, total emission per capita of Ghana grew substantially from 0.08 to 1.9 rising at an increasing annual rate that reached a maximum of 9.41% in 2021") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|