File size: 4,634 Bytes
ce472b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a20aa1b
 
 
 
 
 
ce472b0
 
 
a20aa1b
ce472b0
 
 
 
a20aa1b
ce472b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a20aa1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a2f0b4
a20aa1b
6a2f0b4
a20aa1b
 
ce472b0
 
 
 
 
 
 
 
 
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
130
131
132
133
134
135
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

# Sidebar for navigation
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()

# 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}")

# Show submit button only on last section with red styling
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)

# 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()