|
|
import streamlit as st |
|
|
import pandas as pd |
|
|
import smtplib |
|
|
from email.mime.text import MIMEText |
|
|
|
|
|
|
|
|
st.set_page_config(page_title="AI Maturity Model", layout="wide") |
|
|
|
|
|
|
|
|
sections = [ |
|
|
"Strategy & Execution", |
|
|
"Customer Experience", |
|
|
"Culture & People", |
|
|
"Risk & Cybersecurity", |
|
|
"Finance, Tax & Legal", |
|
|
"Data & Technology" |
|
|
] |
|
|
|
|
|
|
|
|
if "section_index" not in st.session_state: |
|
|
st.session_state.section_index = 0 |
|
|
|
|
|
|
|
|
with st.sidebar: |
|
|
st.header("Navigation") |
|
|
selected_section = st.radio("Select Section", sections, index=st.session_state.section_index, key="sidebar_nav") |
|
|
st.session_state.section_index = sections.index(selected_section) |
|
|
|
|
|
def next_section(): |
|
|
if st.session_state.section_index < len(sections) - 1: |
|
|
st.session_state.section_index += 1 |
|
|
st.rerun() |
|
|
|
|
|
def prev_section(): |
|
|
if st.session_state.section_index > 0: |
|
|
st.session_state.section_index -= 1 |
|
|
st.rerun() |
|
|
|
|
|
|
|
|
questions_dict = { |
|
|
"Customer Experience": [ |
|
|
{ |
|
|
"question": "How does your organization leverage AI for customer interactions?", |
|
|
"options": [ |
|
|
"We are exploring AI capabilities", |
|
|
"We have tested AI in pilot programs", |
|
|
"We have implemented AI in key areas", |
|
|
"AI is fully integrated into customer interactions" |
|
|
] |
|
|
} |
|
|
], |
|
|
"Culture & People": [ |
|
|
{ |
|
|
"question": "How is AI adoption being encouraged in your workforce?", |
|
|
"options": [ |
|
|
"We are raising awareness about AI", |
|
|
"We provide AI training programs", |
|
|
"AI-driven processes are being integrated", |
|
|
"AI is embedded in our organizational culture" |
|
|
] |
|
|
} |
|
|
], |
|
|
"Risk & Cybersecurity": [ |
|
|
{ |
|
|
"question": "Our organization has considered GenAI risks around design, data, performance, inclusivity, third-party, and compliance?", |
|
|
"options": [ |
|
|
"We're in the exploratory phase, researching potential capabilities and benefits", |
|
|
"We've evaluated a pilot program or proof-of-concept", |
|
|
"We've developed a strategic plan and are integrating an enterprise AI solution", |
|
|
"We've integrated solutions into most of our cross-functional initiatives" |
|
|
] |
|
|
}, |
|
|
{ |
|
|
"question": "Our organization has considered integrated GenAI to proactively identify and predict potential risk areas?", |
|
|
"options": [ |
|
|
"We're in the exploratory phase, researching capabilities", |
|
|
"We've conducted pilots to validate feasibility", |
|
|
"We've developed a strategy and are in the integration process", |
|
|
"We've integrated solutions across our organization" |
|
|
] |
|
|
} |
|
|
] |
|
|
} |
|
|
|
|
|
st.title(f"{selected_section}") |
|
|
|
|
|
questions = questions_dict.get(selected_section, []) |
|
|
|
|
|
responses = [] |
|
|
|
|
|
for idx, q in enumerate(questions): |
|
|
response = st.radio(f"Q{idx + 1}: {q['question']}", q["options"], key=f"q{idx}") |
|
|
responses.append({"Section": selected_section, "Question": q["question"], "Answer": response}) |
|
|
st.markdown("---") |
|
|
|
|
|
|
|
|
df = pd.DataFrame(responses) |
|
|
|
|
|
|
|
|
def send_email(dataframe): |
|
|
sender_email = "your_email@example.com" |
|
|
sender_password = "your_password" |
|
|
recipient_email = "recipient@example.com" |
|
|
subject = "AI Maturity Model Responses" |
|
|
body = dataframe.to_string(index=False) |
|
|
|
|
|
msg = MIMEText(body) |
|
|
msg['Subject'] = subject |
|
|
msg['From'] = sender_email |
|
|
msg['To'] = recipient_email |
|
|
|
|
|
try: |
|
|
with smtplib.SMTP("smtp.example.com", 587) as server: |
|
|
server.starttls() |
|
|
server.login(sender_email, sender_password) |
|
|
server.sendmail(sender_email, recipient_email, msg.as_string()) |
|
|
st.success("Responses submitted successfully!") |
|
|
except Exception as e: |
|
|
st.error(f"Error sending responses: {e}") |
|
|
|
|
|
|
|
|
if selected_section == "Data & Technology": |
|
|
st.markdown("<style>div.stButton > button:first-child { background-color: red; color: white; }</style>", unsafe_allow_html=True) |
|
|
if st.button("Submit Questionnaire"): |
|
|
send_email(df) |
|
|
|
|
|
|
|
|
col1, col2 = st.columns([1, 1]) |
|
|
with col1: |
|
|
if st.button("Previous Section"): |
|
|
prev_section() |
|
|
with col2: |
|
|
if st.button("Next Section"): |
|
|
next_section() |
|
|
|