Update app.py
Browse files
app.py
CHANGED
|
@@ -77,35 +77,6 @@ for idx, q in enumerate(questions):
|
|
| 77 |
# Convert responses to DataFrame
|
| 78 |
df = pd.DataFrame(responses)
|
| 79 |
|
| 80 |
-
# Email function
|
| 81 |
-
def send_email(dataframe, recipient_email):
|
| 82 |
-
sender_email = "your_email@example.com"
|
| 83 |
-
sender_password = "your_password"
|
| 84 |
-
subject = "AI Maturity Model Responses"
|
| 85 |
-
body = dataframe.to_string(index=False)
|
| 86 |
-
|
| 87 |
-
msg = MIMEText(body)
|
| 88 |
-
msg['Subject'] = subject
|
| 89 |
-
msg['From'] = sender_email
|
| 90 |
-
msg['To'] = recipient_email
|
| 91 |
-
|
| 92 |
-
try:
|
| 93 |
-
with smtplib.SMTP("smtp.example.com", 587) as server:
|
| 94 |
-
server.starttls()
|
| 95 |
-
server.login(sender_email, sender_password)
|
| 96 |
-
server.sendmail(sender_email, recipient_email, msg.as_string())
|
| 97 |
-
st.success("Email sent successfully!")
|
| 98 |
-
except Exception as e:
|
| 99 |
-
st.error(f"Error sending email: {e}")
|
| 100 |
-
|
| 101 |
-
# Email input and button
|
| 102 |
-
recipient_email = st.text_input("Enter recipient email")
|
| 103 |
-
if st.button("Send Responses via Email"):
|
| 104 |
-
if recipient_email:
|
| 105 |
-
send_email(df, recipient_email)
|
| 106 |
-
else:
|
| 107 |
-
st.error("Please enter a valid email address")
|
| 108 |
-
|
| 109 |
# Navigation Buttons
|
| 110 |
col1, col2 = st.columns([1, 1])
|
| 111 |
with col1:
|
|
|
|
| 77 |
# Convert responses to DataFrame
|
| 78 |
df = pd.DataFrame(responses)
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
# Navigation Buttons
|
| 81 |
col1, col2 = st.columns([1, 1])
|
| 82 |
with col1:
|