Spaces:
Sleeping
Sleeping
Commit ·
017c2ee
1
Parent(s): 0d3291a
Add how to use information
Browse filesUpdate calculator_mode
add navigation button and two pages to display equivalents per impact
12345678910111213141543 unmodified lines5960616263646566676869707172import streamlit as stfrom ecologits.tracers.utils import llm_impactsfrom src.impacts import get_impacts, display_impacts, display_equivalentfrom src.utils import format_impactsfrom src.content import WARNING_CLOSED_SOURCE, WARNING_MULTI_MODAL, WARNING_BOTHfrom src.models import load_modelsfrom src.constants import PROMPTSdef calculator_mode():with st.container(border=True):df = load_models(filter_main=True)43 unmodified lineswith st.container(border=True):st.markdown('<h3 align = "center">Environmental impacts</h3>', unsafe_allow_html=True)st.markdown('<p align = "center">To understand how the environmental impacts are computed go to the 📖 Methodology tab.</p>', unsafe_allow_html=True)display_impacts(impacts)with st.container(border=True):st.markdown('<h3 align = "center">That\'s equivalent to ...</h3>', unsafe_allow_html=True)st.markdown('<p align = "center">Making this request to the LLM is equivalent to the following actions :</p>', unsafe_allow_html=True)display_equivalent(impacts)except Exception as e:st.error('Could not find the model in the repository. Please try another model.')123456789101112131415161743 unmodified lines6162636465666768697071727374757677787980import streamlit as stfrom ecologits.tracers.utils import llm_impactsfrom src.impacts import get_impacts, display_impacts, display_equivalent_ghg, display_equivalent_energyfrom src.utils import format_impactsfrom src.content import WARNING_CLOSED_SOURCE, WARNING_MULTI_MODAL, WARNING_BOTH, HOW_TO_TEXTfrom src.models import load_modelsfrom src.constants import PROMPTSdef calculator_mode():st.expander("How to Use this calculator", expanded = False).markdown(HOW_TO_TEXT)with st.container(border=True):df = load_models(filter_main=True)43 unmodified lineswith st.container(border=True):st.markdown('<h3 align = "center">Environmental impacts</h3>', unsafe_allow_html=True)#st.markdown('<p align = "center">To understand how the environmental impacts are computed go to the 📖 Methodology tab.</p>', unsafe_allow_html=True)display_impacts(impacts)with st.container(border=False):st.markdown('<h3 align = "center">Equivalences</h3>', unsafe_allow_html=True)st.markdown('<p align = "center">Making this request to the LLM is equivalent to the following actions :</p>', unsafe_allow_html=True)page = st.radio(' ', ['Energy' , 'GHG'], horizontal=True)with st.container(border=True):if page == 'Energy' :display_equivalent_energy(impacts)else :display_equivalent_ghg(impacts)except Exception as e:st.error('Could not find the model in the repository. Please try another model.')
src/calculator.py+16-8