import streamlit as st import ecologits from src.utils import ( format_energy_eq_electric_vehicle, format_energy_eq_electricity_consumption_ireland, format_energy_eq_electricity_production, format_energy_eq_physical_activity, format_gwp_eq_airplane_paris_nyc, format_gwp_eq_streaming, PhysicalActivity, EnergyProduction ) ############################################################################################################ def get_impacts(model, active_params, total_params, mix_ghg, mix_adpe, mix_pe): return 1 ############################################################################################################ def display_impacts(impacts): st.divider() col_energy, col_ghg, col_adpe, col_pe, col_water = st.columns(5) with col_energy: st.markdown('
Evaluates the electricity consumption
', unsafe_allow_html = True) with col_ghg: st.markdown('Evaluates the effect on global warming
', unsafe_allow_html = True) with col_adpe: st.markdown('Evaluates the use of metals and minerals
', unsafe_allow_html = True) with col_pe: st.markdown('Evaluates the use of energy resources
', unsafe_allow_html = True) with col_water: st.markdown('Evaluates the use of water
', unsafe_allow_html = True) ############################################################################################################ def display_equivalent(impacts): st.divider() ev_eq = format_energy_eq_electric_vehicle(impacts.energy) streaming_eq = format_gwp_eq_streaming(impacts.gwp) col1, col2, col3 = st.columns(3) with col1: physical_activity, distance = format_energy_eq_physical_activity(impacts.energy) if physical_activity == PhysicalActivity.WALKING: physical_activity = "🚶 " + physical_activity.capitalize() if physical_activity == PhysicalActivity.RUNNING: physical_activity = "🏃 " + physical_activity.capitalize() st.markdown(f'Based on energy consumption
', unsafe_allow_html = True) with col2: ev_eq = format_energy_eq_electric_vehicle(impacts.energy) st.markdown(f'Based on energy consumption
', unsafe_allow_html = True) with col3: streaming_eq = format_gwp_eq_streaming(impacts.gwp) st.markdown(f'Based on GHG emissions
', unsafe_allow_html = True) st.divider() st.markdown('If this use case is largely deployed around the world, the equivalent impacts would be the impacts of this request x 1% of 8 billion people x 365 days in a year.
', unsafe_allow_html = True) col4, col5, col6 = st.columns(3) with col4: electricity_production, count = format_energy_eq_electricity_production(impacts.energy) if electricity_production == EnergyProduction.NUCLEAR: emoji = "☢️" name = "Nuclear power plants" if electricity_production == EnergyProduction.WIND: emoji = "💨️ " name = "Wind turbines" st.markdown(f'Based on energy consumption
', unsafe_allow_html = True) with col5: ireland_count = format_energy_eq_electricity_consumption_ireland(impacts.energy) st.markdown(f'Based on energy consumption
', unsafe_allow_html = True) with col6: paris_nyc_airplane = format_gwp_eq_airplane_paris_nyc(impacts.gwp) st.markdown(f'Based on GHG emissions
', unsafe_allow_html = True)