Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -274,14 +274,23 @@ else:
|
|
274 |
|
275 |
# get time-based scores
|
276 |
time_scores = shelters.apply(lambda row: get_time_score(datetime.now(timezone), row), axis=1).tolist()
|
277 |
-
|
278 |
-
|
279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
# calcualte cumulative score
|
281 |
shelters['total_score'] = shelters[scores].sum(axis=1)
|
282 |
shelters['total_score'] = shelters['total_score'] / len(scores)
|
283 |
|
284 |
shelters = shelters.sort_values(by='total_score', ascending=True)
|
|
|
285 |
shelters = shelters.head(3)
|
286 |
|
287 |
# convert pandas df into list of dicts
|
|
|
274 |
|
275 |
# get time-based scores
|
276 |
time_scores = shelters.apply(lambda row: get_time_score(datetime.now(timezone), row), axis=1).tolist()
|
277 |
+
|
278 |
+
if data['Urgency'] == "Today":
|
279 |
+
for i in range(4):
|
280 |
+
shelters[f'time_score_{i}'] = time_scores
|
281 |
+
scores.append(f'time_score_{i}')
|
282 |
+
elif data['Urgency'] == "In the next few days":
|
283 |
+
shelters['time_score'] = time_scores
|
284 |
+
scores.append('time_score')
|
285 |
+
elif data['Urgency'] == "In a week or more":
|
286 |
+
pass
|
287 |
+
|
288 |
# calcualte cumulative score
|
289 |
shelters['total_score'] = shelters[scores].sum(axis=1)
|
290 |
shelters['total_score'] = shelters['total_score'] / len(scores)
|
291 |
|
292 |
shelters = shelters.sort_values(by='total_score', ascending=True)
|
293 |
+
st.write(shelters)
|
294 |
shelters = shelters.head(3)
|
295 |
|
296 |
# convert pandas df into list of dicts
|