Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -191,8 +191,8 @@ if not st.session_state.form_submitted:
|
|
191 |
duration = st.radio("How long do you need a place to stay?", ("Overnight", "A month or less", "A couple of months", "A year or more"))
|
192 |
needs = st.text_area("Optional - Needs (tell us what you need and how we can help)")
|
193 |
|
194 |
-
|
195 |
-
|
196 |
|
197 |
if st.button("Submit"):
|
198 |
data = {
|
@@ -204,8 +204,8 @@ if not st.session_state.form_submitted:
|
|
204 |
"Urgency": urgency,
|
205 |
"Duration": duration,
|
206 |
"Needs": needs,
|
207 |
-
|
208 |
-
|
209 |
}
|
210 |
|
211 |
with open('data.json', 'w') as f:
|
@@ -353,17 +353,17 @@ else:
|
|
353 |
st.markdown(f" ## [Get Directions](https://www.google.com/maps/dir/?api=1&origin=current+location&destination={lat},{long})")
|
354 |
st.divider()
|
355 |
|
356 |
-
#
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
|
368 |
# Create two columns
|
369 |
col1, col2, col3 = st.columns([1,1,1])
|
|
|
191 |
duration = st.radio("How long do you need a place to stay?", ("Overnight", "A month or less", "A couple of months", "A year or more"))
|
192 |
needs = st.text_area("Optional - Needs (tell us what you need and how we can help)")
|
193 |
|
194 |
+
phone_number = st.text_input('Optional - Enter your phone number (to text shelter info to you)', '+1')
|
195 |
+
consent = st.checkbox('I consent to receiving a one-time message')
|
196 |
|
197 |
if st.button("Submit"):
|
198 |
data = {
|
|
|
204 |
"Urgency": urgency,
|
205 |
"Duration": duration,
|
206 |
"Needs": needs,
|
207 |
+
"Phone Number": phone_number,
|
208 |
+
"Consent": consent
|
209 |
}
|
210 |
|
211 |
with open('data.json', 'w') as f:
|
|
|
353 |
st.markdown(f" ## [Get Directions](https://www.google.com/maps/dir/?api=1&origin=current+location&destination={lat},{long})")
|
354 |
st.divider()
|
355 |
|
356 |
+
# text messaging
|
357 |
+
if len(data['Phone Number']) == 12 and data['Consent']:
|
358 |
+
account_sid = os.environ["SID"]
|
359 |
+
auth_token = os.environ["auth_token"]
|
360 |
+
client = Client(account_sid, auth_token)
|
361 |
|
362 |
+
message = client.messages.create(
|
363 |
+
body = 'test',
|
364 |
+
from_= "+15107212356",
|
365 |
+
to = data['Phone Number']
|
366 |
+
)
|
367 |
|
368 |
# Create two columns
|
369 |
col1, col2, col3 = st.columns([1,1,1])
|