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
12344566789101112131415161743 unmodified lines6162636263646566656667676869707172737475697677787980import streamlit as st
from ecologits.tracers.utils import llm_impacts
from src.impacts import get_impacts, display_impacts, display_equivalent
from src.impacts import get_impacts, display_impacts, display_equivalent_ghg, display_equivalent_energy
from src.utils import format_impacts
from src.content import WARNING_CLOSED_SOURCE, WARNING_MULTI_MODAL, WARNING_BOTH
from src.content import WARNING_CLOSED_SOURCE, WARNING_MULTI_MODAL, WARNING_BOTH, HOW_TO_TEXT
from src.models import load_models
from src.constants import PROMPTS
def 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 lines with 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)
#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)
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(impacts)
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