Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 64 |
-
|
| 65 |
-
#
|
|
|
|
| 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)
|