KeshavRa commited on
Commit
4c8b4d5
·
verified ·
1 Parent(s): 4613f1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import streamlit as st
2
  import json
 
3
 
4
  def validate_zipcode(zipcode):
5
  try:
@@ -15,11 +16,13 @@ def validate_zipcode(zipcode):
15
  def form_dialog():
16
  sex = st.radio("Sex", ("Male", "Female", "Other"))
17
  city = st.radio("City", ("Oakland", "Berkeley", "SF"))
 
 
 
18
  zipcode = st.text_input("Zipcode (Optional)", value="")
19
  urgency = st.radio("How quickly do you need help?", ("Today", "In the next few days", "In a week or more"))
20
  duration = st.radio("How long do you need a place to stay?", ("A year or more", "A couple of months", "A month or less"))
21
- lgbtq = st.radio("Do you identify as LGBTQ+ (some shelters serve specifically this community", ("Yes", "No"))
22
- domestic_violence = st.radio("Are you experiencing domestic violence (some shelters serve these individuals specifically", ("Yes", "No"))
23
  needs = st.text_area("Needs (Optional - tell us what you need and how we can help)", value="")
24
 
25
  if st.button("Submit"):
@@ -29,6 +32,9 @@ def form_dialog():
29
  data = {
30
  "Sex": sex,
31
  "City": city,
 
 
 
32
  "Zipcode": zipcode,
33
  "Urgency": urgency,
34
  "Duration": duration,
@@ -42,6 +48,11 @@ def form_dialog():
42
  st.session_state.data = data
43
  st.rerun()
44
 
 
 
 
 
 
45
  # Initialize session state
46
  if 'form_submitted' not in st.session_state:
47
  st.session_state.form_submitted = False
 
1
  import streamlit as st
2
  import json
3
+ import pandas as pd
4
 
5
  def validate_zipcode(zipcode):
6
  try:
 
16
  def form_dialog():
17
  sex = st.radio("Sex", ("Male", "Female", "Other"))
18
  city = st.radio("City", ("Oakland", "Berkeley", "SF"))
19
+ lgbtq = st.radio("Do you identify as LGBTQ+ (some shelters serve specifically this community", ("Yes", "No"))
20
+ domestic_violence = st.radio("Are you experiencing domestic violence (some shelters serve these individuals specifically", ("Yes", "No"))
21
+
22
  zipcode = st.text_input("Zipcode (Optional)", value="")
23
  urgency = st.radio("How quickly do you need help?", ("Today", "In the next few days", "In a week or more"))
24
  duration = st.radio("How long do you need a place to stay?", ("A year or more", "A couple of months", "A month or less"))
25
+
 
26
  needs = st.text_area("Needs (Optional - tell us what you need and how we can help)", value="")
27
 
28
  if st.button("Submit"):
 
32
  data = {
33
  "Sex": sex,
34
  "City": city,
35
+ "LGBTQ": lgbtq,
36
+ "Domestic Violence": domestic_violence
37
+
38
  "Zipcode": zipcode,
39
  "Urgency": urgency,
40
  "Duration": duration,
 
48
  st.session_state.data = data
49
  st.rerun()
50
 
51
+ shelters = pd.read_csv("Database.csv")
52
+
53
+ filtered_shelters = shelters[(shelters['Sex'] == data['Sex']) & (shelters['City'] == data['City']) & (shelters['LGBTQ'] == data['LGBTQ']) & (shelters['Domestic Violence'] == data['Domestic Violence'])]
54
+ st.table(filtered_shelters)
55
+
56
  # Initialize session state
57
  if 'form_submitted' not in st.session_state:
58
  st.session_state.form_submitted = False