nniehaus commited on
Commit
fef30d6
·
verified ·
1 Parent(s): 830f5f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -57,12 +57,13 @@ if st.session_state["reply"]:
57
  st.markdown("<h2 style='text-align: center; color: black;'>Recommended Neighborhoods ⬇️</h2>", unsafe_allow_html=True)
58
  st.write(st.session_state["reply"])
59
 
60
- # Extract neighborhood, city, and state information
61
  neighborhoods = []
62
  for line in st.session_state["reply"].splitlines():
63
- if ":" in line:
64
- location = line.split(":")[0].strip() # Full location "Neighborhood, City, State"
65
- # Remove any leading numbering
 
66
  if location[0].isdigit():
67
  location = location.split(" ", 1)[1].strip()
68
  neighborhoods.append(location)
 
57
  st.markdown("<h2 style='text-align: center; color: black;'>Recommended Neighborhoods ⬇️</h2>", unsafe_allow_html=True)
58
  st.write(st.session_state["reply"])
59
 
60
+ # Extract neighborhood, city, and state information accurately
61
  neighborhoods = []
62
  for line in st.session_state["reply"].splitlines():
63
+ # Look for lines in the format "Neighborhood: Location: ..."
64
+ if "Location:" not in line and "Description:" not in line and ":" in line:
65
+ location = line.split(":")[0].strip() # Get "Neighborhood, City, State"
66
+ # Remove any leading numbering if it exists
67
  if location[0].isdigit():
68
  location = location.split(" ", 1)[1].strip()
69
  neighborhoods.append(location)