File size: 4,196 Bytes
aeec186 36080eb aeec186 a3ebf49 36080eb a3ebf49 7940953 7d2d236 a3ebf49 7d2d236 7940953 36080eb a3ebf49 36080eb a3ebf49 7d2d236 36080eb a3ebf49 f03fa95 36080eb f03fa95 36080eb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
import streamlit as st
import pandas as pd
import smtplib
from email.mime.text import MIMEText
# Page config
st.set_page_config(page_title="AI Maturity Model", layout="wide")
# Sidebar Navigation
sections = [
"Strategy & Execution",
"Customer Experience",
"Culture & People",
"Risk & Cybersecurity",
"Finance, Tax & Legal",
"Data & Technology"
]
# Session state for navigation
if "section_index" not in st.session_state:
st.session_state.section_index = 0
def next_section():
if st.session_state.section_index < len(sections) - 1:
st.session_state.section_index += 1
def prev_section():
if st.session_state.section_index > 0:
st.session_state.section_index -= 1
selected_section = sections[st.session_state.section_index]
# Sample questions per section
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("---")
# Convert responses to DataFrame
df = pd.DataFrame(responses)
# Email function
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}")
# Submit button
if st.button("Submit Questionnaire"):
send_email(df)
# Navigation Buttons
col1, col2 = st.columns([1, 1])
with col1:
if st.button("Previous Section"):
prev_section()
with col2:
if st.button("Next Section"):
next_section()
st.experimental_rerun()
|