jaothan commited on
Commit
64702f2
·
verified ·
1 Parent(s): 581feba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -36
app.py CHANGED
@@ -1,7 +1,4 @@
1
  import streamlit as st
2
- import pandas as pd
3
- import smtplib
4
- from email.mime.text import MIMEText
5
 
6
  # Page config
7
  st.set_page_config(page_title="AI Maturity Model", layout="wide")
@@ -67,42 +64,11 @@ st.title(f"{selected_section}")
67
 
68
  questions = questions_dict.get(selected_section, [])
69
 
70
- responses = []
71
-
72
  for idx, q in enumerate(questions):
73
- response = st.radio(f"Q{idx + 1}: {q['question']}", q["options"], key=f"q{idx}")
74
- responses.append({"Section": selected_section, "Question": q["question"], "Answer": response})
75
  st.markdown("---")
76
 
77
- # Convert responses to DataFrame
78
- df = pd.DataFrame(responses)
79
-
80
- # Email function
81
- def send_email(dataframe):
82
- sender_email = "your_email@example.com"
83
- sender_password = "your_password"
84
- recipient_email = "recipient@example.com"
85
- subject = "AI Maturity Model Responses"
86
- body = dataframe.to_string(index=False)
87
-
88
- msg = MIMEText(body)
89
- msg['Subject'] = subject
90
- msg['From'] = sender_email
91
- msg['To'] = recipient_email
92
-
93
- try:
94
- with smtplib.SMTP("smtp.example.com", 587) as server:
95
- server.starttls()
96
- server.login(sender_email, sender_password)
97
- server.sendmail(sender_email, recipient_email, msg.as_string())
98
- st.success("Responses submitted successfully!")
99
- except Exception as e:
100
- st.error(f"Error sending responses: {e}")
101
-
102
- # Submit button
103
- if st.button("Submit Questionnaire"):
104
- send_email(df)
105
-
106
  # Navigation Buttons
107
  col1, col2 = st.columns([1, 1])
108
  with col1:
 
1
  import streamlit as st
 
 
 
2
 
3
  # Page config
4
  st.set_page_config(page_title="AI Maturity Model", layout="wide")
 
64
 
65
  questions = questions_dict.get(selected_section, [])
66
 
 
 
67
  for idx, q in enumerate(questions):
68
+ st.subheader(f"Q{idx + 1}: {q['question']}")
69
+ st.radio("", q["options"], key=f"q{idx}")
70
  st.markdown("---")
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  # Navigation Buttons
73
  col1, col2 = st.columns([1, 1])
74
  with col1: