Spaces:
Sleeping
Sleeping
Commit
·
94b1746
1
Parent(s):
d99df65
Update app.py
Browse files
app.py
CHANGED
@@ -88,6 +88,31 @@ def predict_horoscope(m_sign, f_sign,strtime,m_daily_pred,f_daily_pred,m_monthly
|
|
88 |
prediction = chatresponse.choices[0].message.content
|
89 |
return prediction
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
def main():
|
92 |
|
93 |
st.set_page_config(
|
@@ -142,6 +167,10 @@ def main():
|
|
142 |
#st.success("Insight generated!")
|
143 |
st.markdown(prediction)
|
144 |
#st.text(prediction)
|
|
|
|
|
|
|
|
|
145 |
|
146 |
if __name__ == '__main__':
|
147 |
main()
|
|
|
88 |
prediction = chatresponse.choices[0].message.content
|
89 |
return prediction
|
90 |
|
91 |
+
def send_email(email,msg,stdate):
|
92 |
+
# Your Gmail credentials
|
93 |
+
sender_email = "[email protected]"
|
94 |
+
sender_password = "ibxccfsdcyzeittm"
|
95 |
+
|
96 |
+
# Recipient email address
|
97 |
+
receiver_email = email
|
98 |
+
|
99 |
+
message = MIMEMultipart("alternative")
|
100 |
+
message["Subject"] = "Horoscope Insights of " + stdate
|
101 |
+
message["From"] = sender_email
|
102 |
+
message["To"] = receiver_email
|
103 |
+
|
104 |
+
text = msg
|
105 |
+
|
106 |
+
part1 = MIMEText(text, "plain")
|
107 |
+
message.attach(part1)
|
108 |
+
|
109 |
+
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
|
110 |
+
server.login(sender_email, sender_password)
|
111 |
+
server.sendmail(sender_email, receiver_email, message.as_string())
|
112 |
+
server.quit()
|
113 |
+
|
114 |
+
|
115 |
+
|
116 |
def main():
|
117 |
|
118 |
st.set_page_config(
|
|
|
167 |
#st.success("Insight generated!")
|
168 |
st.markdown(prediction)
|
169 |
#st.text(prediction)
|
170 |
+
if st.button("Send Email"):
|
171 |
+
email="[email protected]"
|
172 |
+
send_email(email,prediction,strtime)
|
173 |
+
st.success("Email sent successfully!")
|
174 |
|
175 |
if __name__ == '__main__':
|
176 |
main()
|