import streamlit as st
st.set_page_config(page_title="AI Tool Integration Evaluator", layout="centered")
custom_css = """
"""
st.markdown(custom_css, unsafe_allow_html=True)
if "step" not in st.session_state: st.session_state.step = 0
if "N" not in st.session_state: st.session_state.N = 0
if "U" not in st.session_state: st.session_state.U = 0
if "model_choice" not in st.session_state: st.session_state.model_choice = ""
if "FEin" not in st.session_state: st.session_state.FEin = 0.0
if "FEout" not in st.session_state: st.session_state.FEout = 0.0
if "Tin" not in st.session_state: st.session_state.Tin = 0
if "Tout" not in st.session_state: st.session_state.Tout = 0
if "Tin_type" not in st.session_state: st.session_state.Tin_type = ""
if "Tout_type" not in st.session_state: st.session_state.Tout_type = ""
if "R" not in st.session_state: st.session_state.R = 0
if "F" not in st.session_state: st.session_state.F = 0
if "G" not in st.session_state: st.session_state.G = 0
if "testing" not in st.session_state: st.session_state.testing = 0
if "dev" not in st.session_state: st.session_state.dev = 0
if "nb_projects_pod" not in st.session_state: st.session_state.nb_projects_pod = 1
if "needs_web_interface" not in st.session_state: st.session_state.needs_web_interface = "No"
if "business_impact" not in st.session_state: st.session_state.business_impact = ""
if "alternative_tool" not in st.session_state: st.session_state.alternative_tool = ""
if "expertise_risk" not in st.session_state: st.session_state.expertise_risk = ""
if "training_required" not in st.session_state: st.session_state.training_required = ""
if "Tform" not in st.session_state: st.session_state.Tform = 0.0
if "Treel" not in st.session_state: st.session_state.Treel = 0.0
if "Tia" not in st.session_state: st.session_state.Tia = 0.0
if "Tvv" not in st.session_state: st.session_state.Tvv = 0.0
if "Tvvia" not in st.session_state: st.session_state.Tvvia = 0.0
if "data_classification" not in st.session_state: st.session_state.data_classification = ""
if "nogo" not in st.session_state: st.session_state.nogo = False
if "ai_emission" not in st.session_state: st.session_state.ai_emission = 0.0
if "price_per_year" not in st.session_state: st.session_state.price_per_year = 0.0
def next_step():
st.session_state.step += 1
def get_emission_visual(emission_g):
emission_kg = emission_g / 1000.0
if emission_kg < 1:
text = "**Less than 1 kg CO₂eq**: Equivalent to the emissions of one passenger flying ~10 km in an A320neo (40 seconds)."
elif emission_kg < 5:
text = "**1 to 5 kg CO₂eq**: Equivalent to a standard car commute from Toulouse city center to the Airbus Blagnac campus."
elif emission_kg < 10:
text = "**5 to 10 kg CO₂eq**: Equivalent to the emissions of one passenger flying a very short route (~100 km)."
elif emission_kg < 15:
text = "**10 to 15 kg CO₂eq**: Equivalent to the manufacturing of a standard A320 passenger cabin window."
elif emission_kg < 20:
text = "**15 to 20 kg CO₂eq**: Equivalent to the combustion of about 5 to 6 liters of aviation fuel (Jet A-1)."
elif emission_kg < 25:
text = "**20 to 25 kg CO₂eq**: Equivalent to running an A320's APU on the ground for about 15 minutes."
elif emission_kg < 30:
text = "**25 to 30 kg CO₂eq**: Equivalent to the emissions of one passenger on a short regional flight (Toulouse to Lyon)."
elif emission_kg < 35:
text = "**30 to 35 kg CO₂eq**: Equivalent to the emissions of an A320neo operating at full takeoff thrust for just 5 seconds."
elif emission_kg < 40:
text = "**35 to 40 kg CO₂eq**: Equivalent to the fuel emissions of an Airbus Beluga taxiing on the tarmac for a few minutes."
elif emission_kg < 45:
text = "**40 to 45 kg CO₂eq**: Equivalent to the emissions of an A320 family aircraft running its engines at idle for about 90 seconds."
elif emission_kg <= 50:
text = "**45 to 50 kg CO₂eq**: Equivalent to the emissions of one passenger flying from Toulouse to Paris (entire flight)."
else:
text = "🛑 **More than 50 kg CO₂eq**: Exceeds a one-way flight from Toulouse to Paris per passenger. This is a massive impact and potentially a NO-GO for a single background IT tool."
pos = min((emission_kg / 50.0) * 100, 100)
html = f"""
Environmental Impact Scale (0 to 50+ kg) :
{text}
"""
return html
if st.session_state.step > 0:
st.title("AI Tool Integration Evaluator")
if st.session_state.step == 0:
st.title("Welcome to the AI Tool Integration Evaluator")
st.markdown(
"### This tool aims to evaluate the environmental, financial, and operational impacts of an AI-driven tool.")
st.write(
"While Artificial Intelligence is a highly effective technology capable of driving major innovations, "
"it also represents a significant environmental footprint and operational cost. "
"Before investing resources into development, it is crucial to evaluate whether its integration is truly indispensable."
)
st.write(
"This questionnaire will guide you step-by-step to assess the viability and true cost of your AI use case.")
st.divider()
if st.button("Start Questionnaire"):
next_step()
st.rerun()
elif st.session_state.step == 1:
st.subheader("Question 1")
st.write("**How many users will use the tool?**")
with st.form(key="form_q1"):
user_input = st.number_input("Number of users", min_value=1, value=1, step=1, label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.N = user_input
next_step()
st.rerun()
elif st.session_state.step == 2:
st.subheader("Question 2")
st.write("**What will be the use frequency?**")
freq_values = {"Daily": 200, "Weekly": 50, "Monthly": 10, "Annual": 2}
with st.form(key="form_q2"):
choice = st.radio("Select frequency:", options=list(freq_values.keys()), label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.U = freq_values[choice]
next_step()
st.rerun()
elif st.session_state.step == 3:
st.subheader("Question 3")
st.write("**Which AI model will be integrated?**")
model_values = {
"Light model - SLM (Llama3, Phi-3)": {"FEin": 0.005 / 1000, "FEout": 0.015 / 1000},
"Medium model (Claude Sonnet, Gemini Flash, Mistral 8x7b)": {"FEin": 0.03 / 1000, "FEout": 0.08 / 1000},
"Large model - LLM (GPT4, Gemini Pro)": {"FEin": 0.15 / 1000, "FEout": 0.45 / 1000}
}
with st.form(key="form_q3"):
choice = st.radio("Select model:", options=list(model_values.keys()), label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.model_choice = choice
st.session_state.FEin = model_values[choice]["FEin"]
st.session_state.FEout = model_values[choice]["FEout"]
next_step()
st.rerun()
elif st.session_state.step == 4:
st.subheader("Question 4")
st.write("**What type of data will be provided to the AI?**")
tin_values = {
"Question (sentence)": 50, "Picture": 765, "Document (less than 15 pages)": 2000,
"Document (more than 15 pages)": 15000, "Video": 30000
}
with st.form(key="form_q4"):
choice = st.radio("Select data type:", options=list(tin_values.keys()), label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.Tin = tin_values[choice]
st.session_state.Tin_type = choice
next_step()
st.rerun()
elif st.session_state.step == 5:
st.subheader("Question 5")
st.write("**What type of data will be generated by the AI?**")
tout_values = {
"Sentence (10-20 words)": 50, "text": 350, "function (code)": 600,
"document (less than 15 pages)": 1500, "document (more than 15 pages)": 20000,
"picture": 4000, "video": 50000
}
with st.form(key="form_q5"):
choice = st.radio("Select generated data type:", options=list(tout_values.keys()), label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.Tout = tout_values[choice]
st.session_state.Tout_type = choice
next_step()
st.rerun()
elif st.session_state.step == 6:
st.subheader("Question 6")
st.write("**How many AI calls will be made each time the tool is used?**")
with st.form(key="form_q6"):
user_input = st.number_input("Number of AI calls", min_value=1, value=1, step=1, label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.R = user_input
next_step()
st.rerun()
elif st.session_state.step == 7:
st.subheader("Question 7")
st.write("**How will the AI call be triggered?**")
f_values = {"User on-demand": 1, "Automatic / Background": 5}
with st.form(key="form_q7"):
choice = st.radio("Select trigger type:", options=list(f_values.keys()), label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.F = f_values[choice]
next_step()
st.rerun()
elif st.session_state.step == 8:
st.subheader("Question 8")
st.write("**How will the tool be coded?**")
g_values = {"Self-competencies or GenAI documentation": 1, "Gemini support": 10}
with st.form(key="form_q8"):
choice = st.radio("Select coding method:", options=list(g_values.keys()), label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.G = g_values[choice]
next_step()
st.rerun()
elif st.session_state.step == 9:
st.subheader("Question 9")
st.write("**How will you resolve code failures?**")
with st.form(key="form_q9"):
choice = st.radio("Select resolution method:", options=["Other tools", "With AI"], label_visibility="collapsed")
if st.form_submit_button("Next"):
if choice == "Other tools":
st.session_state.testing = 0
st.session_state.dev = 0
st.session_state.step = 12
else:
st.session_state.step = 10
st.rerun()
elif st.session_state.step == 10:
st.subheader("Question 10")
st.write("**Is AI generation required for every test of the tool?**")
with st.form(key="form_q10"):
choice = st.radio("Select:", options=["NO", "YES"], label_visibility="collapsed")
if st.form_submit_button("Next"):
if choice == "NO":
st.session_state.testing = 0
st.session_state.dev = 0
st.session_state.step = 12
else:
st.session_state.step = 11
st.rerun()
elif st.session_state.step == 11:
st.subheader("Question 11")
st.write("**What is the forecasted volume of requests per year (for development and testing phases)?**")
with st.form(key="form_q11"):
user_input = st.number_input("Number of requests", min_value=0, value=0, step=1, label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.testing = user_input
st.session_state.dev = user_input
st.session_state.step = 12
st.rerun()
elif st.session_state.step == 12:
st.subheader("Question 12")
st.write("**Are there other projects within the Google Cloud POD that will be used?**")
with st.form(key="form_q12"):
choice = st.radio("Select:", options=["No", "Yes"], label_visibility="collapsed")
if st.form_submit_button("Next"):
if choice == "No":
st.session_state.nb_projects_pod = 1
st.session_state.step = 14
else:
st.session_state.step = 13
st.rerun()
elif st.session_state.step == 13:
st.subheader("Question 13")
st.write("**How many projects are there within the POD?**")
with st.form(key="form_q13"):
user_input = st.number_input("Total projects", min_value=1, value=2, step=1, label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.nb_projects_pod = user_input
st.session_state.step = 14
st.rerun()
elif st.session_state.step == 14:
st.subheader("Question 14")
st.write("**Will the tool have a dedicated web interface that runs continuously?**")
st.write("*(e.g., A custom dashboard or web app deployed on Cloud Run).*")
with st.form(key="form_q14"):
choice = st.radio("Select:", options=["Yes", "No"], label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.needs_web_interface = choice
st.session_state.step = 15
st.rerun()
elif st.session_state.step == 15:
st.subheader("Question 15")
st.write("**What is the business impact if this tool is not developed?**")
options_impact = [
"Slight (AI used for Document formatting, translate, generation of data not linked with the business)",
"Significant (Major improvements, KPIs enhancement, time saving...)"
]
with st.form(key="form_q15"):
choice = st.radio("Select business impact:", options=options_impact, label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.business_impact = choice
if choice == options_impact[0]:
st.session_state.step = 17 # NO-GO
else:
st.session_state.step = 16
st.rerun()
elif st.session_state.step == 16:
st.subheader("Question 16")
st.write("**Is there a tool other than AI capable of performing the task?**")
with st.form(key="form_q16"):
choice = st.radio("Select:", options=["Yes", "No"], label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.alternative_tool = choice
if choice == "Yes":
st.session_state.step = 17 # NO-GO
else:
st.session_state.step = 18
st.rerun()
elif st.session_state.step == 17:
st.header("🛑 NO-GO AI (Info)")
st.info(
"Based on your answers, AI might not be the recommended solution for this specific step. You will skip the remaining feasibility questions.")
st.divider()
if st.button("Continue (Skip next questions)"):
st.session_state.nogo = True
st.session_state.step = 27
st.rerun()
elif st.session_state.step == 18:
st.subheader("Question 17")
st.write("**Does automation risk causing teams to lose their manual expertise?**")
with st.form(key="form_q18"):
choice = st.radio("Select:", options=["Yes", "No"], label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.expertise_risk = choice
if choice == "Yes":
st.session_state.step = 17 # NO-GO
else:
st.session_state.step = 19
st.rerun()
elif st.session_state.step == 19:
st.subheader("Question 18")
st.write("**Is training required before using the tool?**")
with st.form(key="form_q19"):
choice = st.radio("Select:", options=["Yes", "No"], label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.training_required = choice
if choice == "No":
st.session_state.Tform = 0.0
st.session_state.step = 21
else:
st.session_state.step = 20
st.rerun()
elif st.session_state.step == 20:
st.subheader("Question 19")
st.write("**What is the expected training duration for an individual (in hours)?**")
with st.form(key="form_q20"):
user_input = st.number_input("Training duration (hours)", min_value=0.0, value=1.0, step=0.5,
label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.Tform = user_input
st.session_state.step = 21
st.rerun()
elif st.session_state.step == 21:
st.subheader("Question 20")
st.write("**How many hours does it currently take to perform this task manually (without AI)?**")
with st.form(key="form_q21"):
user_input = st.number_input("Current time (hours)", min_value=0.0, value=1.0, step=0.5,
label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.Treel = user_input
st.session_state.step = 22
st.rerun()
elif st.session_state.step == 22:
st.subheader("Question 21")
st.write("**What is the estimated time (in hours) to complete this task using the AI tool?**")
with st.form(key="form_q22"):
user_input = st.number_input("Time with AI (hours)", min_value=0.0, value=0.5, step=0.5,
label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.Tia = user_input
st.session_state.step = 23
st.rerun()
elif st.session_state.step == 23:
st.subheader("Question 22")
st.write("**Are the AI-generated data intended to be certified and thus go through a V&V process?**")
with st.form(key="form_q23"):
choice = st.radio("Select:", options=["Yes", "No"], label_visibility="collapsed")
if st.form_submit_button("Next"):
if choice == "Yes":
st.session_state.step = 24
else:
st.session_state.Tvv = 0.0
st.session_state.Tvvia = 0.0
st.session_state.step = 26
st.rerun()
elif st.session_state.step == 24:
st.subheader("Question 23")
st.write("**What is the current time required for the V&V process (in hours)?**")
with st.form(key="form_q24"):
user_input = st.number_input("Current V&V time (hours)", min_value=0.0, value=1.0, step=0.5,
label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.Tvv = user_input
st.session_state.step = 25
st.rerun()
elif st.session_state.step == 25:
st.subheader("Question 24")
st.write("**What is the expected time for the V&V process for AI-generated data (in hours)?**")
with st.form(key="form_q25"):
user_input = st.number_input("V&V time for AI data (hours)", min_value=0.0, value=1.0, step=0.5,
label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.Tvvia = user_input
st.session_state.step = 26
st.rerun()
elif st.session_state.step == 26:
st.subheader("Question 25")
st.write("**What is the classification of the input and output data?**")
options_class = ["Airbus Amber / without any classification", "Airbus RED"]
with st.form(key="form_q26"):
choice = st.radio("Select data classification:", options=options_class, label_visibility="collapsed")
if st.form_submit_button("Next"):
st.session_state.data_classification = choice
if choice == "Airbus RED":
st.session_state.step = 17 # NO-GO
else:
st.session_state.step = 27
st.rerun()
elif st.session_state.step == 27:
model = st.session_state.model_choice
Tin = st.session_state.Tin
Tout = st.session_state.Tout
Tin_type = st.session_state.Tin_type
Tout_type = st.session_state.Tout_type
N = st.session_state.N
U = st.session_state.U
R = st.session_state.R
F = st.session_state.F
dev = st.session_state.dev
testing = st.session_state.testing
FEin = st.session_state.FEin
FEout = st.session_state.FEout
G = st.session_state.G
nb_projects_pod = max(st.session_state.nb_projects_pod, 1)
Pin = 0.0
Pout = 0.0
if model == "Light model - SLM (Llama3, Phi-3)":
Pin = 0.3 * Tin / 1_000_000
Pout = 0.7 * Tout / 1_000_000
elif model == "Medium model (Claude Sonnet, Gemini Flash, Mistral 8x7b)":
Pin = 1.5 * Tin / 1_000_000
Pout = 7.5 * Tout / 1_000_000
elif model == "Large model - LLM (GPT4, Gemini Pro)":
Pin = 2.0 * Tin / 1_000_000 if Tin <= 200000 else 4.0 * Tin / 1_000_000
Pout = 12.0 * Tout / 1_000_000 if Tout <= 200000 else 18.0 * Tout / 1_000_000
execution_times = {
"Sentence (10-20 words)": {"Light model - SLM (Llama3, Phi-3)": 0.80,
"Medium model (Claude Sonnet, Gemini Flash, Mistral 8x7b)": 0.5,
"Large model - LLM (GPT4, Gemini Pro)": 2},
"text": {"Light model - SLM (Llama3, Phi-3)": 2.50,
"Medium model (Claude Sonnet, Gemini Flash, Mistral 8x7b)": 1.5,
"Large model - LLM (GPT4, Gemini Pro)": 5},
"function (code)": {"Light model - SLM (Llama3, Phi-3)": 5.50,
"Medium model (Claude Sonnet, Gemini Flash, Mistral 8x7b)": 3.0,
"Large model - LLM (GPT4, Gemini Pro)": 11},
"document (less than 15 pages)": {"Light model - SLM (Llama3, Phi-3)": 80.0,
"Medium model (Claude Sonnet, Gemini Flash, Mistral 8x7b)": 45.0,
"Large model - LLM (GPT4, Gemini Pro)": 160},
"document (more than 15 pages)": {"Light model - SLM (Llama3, Phi-3)": 150.0,
"Medium model (Claude Sonnet, Gemini Flash, Mistral 8x7b)": 85.0,
"Large model - LLM (GPT4, Gemini Pro)": 300},
"picture": {"Light model - SLM (Llama3, Phi-3)": 2.0,
"Medium model (Claude Sonnet, Gemini Flash, Mistral 8x7b)": 10.0,
"Large model - LLM (GPT4, Gemini Pro)": 15},
"video": {"Light model - SLM (Llama3, Phi-3)": 120.0,
"Medium model (Claude Sonnet, Gemini Flash, Mistral 8x7b)": 160.0,
"Large model - LLM (GPT4, Gemini Pro)": 180}
}
if Tout_type and model:
st.session_state.time_exec = execution_times[Tout_type][model]
st.session_state.Prun = (0.0000265 * st.session_state.time_exec) + (0.40 / 1_000_000)
total_calls_year = (N * U * R * F) + G + testing
inference_emission = total_calls_year * ((Tin * FEin) + (Tout * FEout))
inference_cost = total_calls_year * (st.session_state.Prun + Pin + Pout)
data_weights = {
"Question (sentence)": 0.001, "Sentence (10-20 words)": 0.001, "text": 0.01, "function (code)": 0.01,
"Picture": 2.0, "picture": 2.0, "Document (less than 15 pages)": 1.0, "document (less than 15 pages)": 1.0,
"Document (more than 15 pages)": 5.0, "document (more than 15 pages)": 5.0, "Video": 50.0, "video": 50.0
}
size_in_mb = data_weights.get(Tin_type, 0.1)
size_out_mb = data_weights.get(Tout_type, 0.1)
total_data_gb_year = (total_calls_year * (size_in_mb + size_out_mb)) / 1000.0
network_cost = total_data_gb_year * 0.12
network_emission = total_data_gb_year * 50.0
infra_cost = 0.0
infra_emission = 0.0
infra_cost += (132.0 / nb_projects_pod)
infra_emission += (5500.0 / nb_projects_pod)
if st.session_state.needs_web_interface == "Yes":
infra_cost += 350.0
infra_emission += 12000.0
st.session_state.ai_emission = inference_emission + network_emission + infra_emission
st.session_state.price_per_year = inference_cost + network_cost + infra_cost
annual_time_savings = ((st.session_state.Treel - st.session_state.Tia) + (
st.session_state.Tvv - st.session_state.Tvvia) - st.session_state.Tform) * st.session_state.U
tool_implementation_time = st.session_state.Tform + st.session_state.Tia + st.session_state.Tvvia
st.header("Final Evaluation Results")
if not st.session_state.nogo:
st.success("** Go AI but keep in mind...**")
else:
st.warning(
"**Note**: You bypassed some steps due to a NO-GO AI condition. Here are your partial/simulated metrics.")
col1, col2 = st.columns(2)
with col1:
st.metric(label="Price per year", value=f"€ {st.session_state.price_per_year:,.2f}")
st.metric(label="Annual Time Savings", value=f"{annual_time_savings:,.2f} h")
with col2:
st.metric(label="AI Emission", value=f"{st.session_state.ai_emission:,.2f} gCO₂eq")
st.metric(label="Tool Implementation Time", value=f"{tool_implementation_time:,.2f} h")
st.markdown(get_emission_visual(st.session_state.ai_emission), unsafe_allow_html=True)
st.divider()
if st.button("Start Over"):
for key in list(st.session_state.keys()):
del st.session_state[key]
st.rerun()