Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -55,16 +55,7 @@ def get_duration_score(user, shelter):
|
|
55 |
if shelter == "Temporary": return 0.75
|
56 |
if shelter == "Transitional": return 0.5
|
57 |
if shelter == "Long-Term": return 0
|
58 |
-
|
59 |
-
def get_zip_codes(city, state):
|
60 |
-
url = f'http://api.zippopotam.us/us/{state}/{city}'
|
61 |
-
response = requests.get(url)
|
62 |
-
if response.status_code == 200:
|
63 |
-
data = response.json()
|
64 |
-
return [place['post code'] for place in data['places']]
|
65 |
-
else:
|
66 |
-
return []
|
67 |
-
|
68 |
def get_coordinates(zipcode: str, api_key: str) -> list:
|
69 |
"""
|
70 |
Get the coordinates (latitude and longitude) of an address using the OpenWeather Geocoding API.
|
@@ -98,17 +89,9 @@ def haversine(lat1, lon1, lat2, lon2):
|
|
98 |
|
99 |
# Function to handle form submission
|
100 |
@st.experimental_dialog("Fill out the form")
|
101 |
-
def form_dialog():
|
102 |
-
|
103 |
-
|
104 |
-
"Oakland": get_zip_codes("Oakland", "CA"),
|
105 |
-
"Berkeley": get_zip_codes("Berkeley", "CA")
|
106 |
-
}
|
107 |
-
|
108 |
-
city = st.selectbox("City", list(city_zipcodes.keys()))
|
109 |
-
zipcode = st.selectbox("Zipcode", ['Unsure'] + city_zipcodes[city])
|
110 |
-
# city = st.selectbox("City", ['San Francisco', 'Oakland', 'Berkeley'])
|
111 |
-
# zipcode = st.selectbox("Zipcode", [0, 1, 2])
|
112 |
|
113 |
sex = st.radio("Sex", ["Male", "Female", "Other"])
|
114 |
lgbtq = st.radio("Do you identify as LGBTQ+ (some shelters serve this community specifically)", ["No", "Yes"])
|
|
|
55 |
if shelter == "Temporary": return 0.75
|
56 |
if shelter == "Transitional": return 0.5
|
57 |
if shelter == "Long-Term": return 0
|
58 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
def get_coordinates(zipcode: str, api_key: str) -> list:
|
60 |
"""
|
61 |
Get the coordinates (latitude and longitude) of an address using the OpenWeather Geocoding API.
|
|
|
89 |
|
90 |
# Function to handle form submission
|
91 |
@st.experimental_dialog("Fill out the form")
|
92 |
+
def form_dialog():
|
93 |
+
city = st.selectbox("City", ['San Francisco', 'Oakland', 'Berkeley'])
|
94 |
+
zipcode = st.text_input("Zipcode")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
sex = st.radio("Sex", ["Male", "Female", "Other"])
|
97 |
lgbtq = st.radio("Do you identify as LGBTQ+ (some shelters serve this community specifically)", ["No", "Yes"])
|