Update app.py
Browse files
app.py
CHANGED
@@ -590,48 +590,22 @@ elif option == "Symptom Checker":
|
|
590 |
elif option == "Doctor Connect":
|
591 |
st.subheader("π₯ Find a Doctor Near You")
|
592 |
|
593 |
-
st.
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
if use_manual:
|
606 |
-
manual_input = st.text_input("Enter your location (City, State or Latitude, Longitude):")
|
607 |
-
if manual_input:
|
608 |
-
geolocator = Nominatim(user_agent="geoapi")
|
609 |
-
try:
|
610 |
-
# Handle input as coordinates if comma is found
|
611 |
-
if "," in manual_input:
|
612 |
-
parts = manual_input.split(",")
|
613 |
-
lat = float(parts[0].strip())
|
614 |
-
lon = float(parts[1].strip())
|
615 |
-
else:
|
616 |
-
location = geolocator.geocode(manual_input)
|
617 |
-
if location:
|
618 |
-
lat, lon = location.latitude, location.longitude
|
619 |
-
else:
|
620 |
-
st.error("β Invalid location entered.")
|
621 |
-
lat, lon = None, None
|
622 |
-
except:
|
623 |
-
st.error("β Error parsing location input.")
|
624 |
-
lat, lon = None, None
|
625 |
else:
|
626 |
-
|
627 |
else:
|
628 |
-
|
629 |
|
630 |
-
if lat and lon:
|
631 |
-
st.success(f"π Final Location: Latitude {lat}, Longitude {lon}")
|
632 |
-
map_ = folium.Map(location=[lat, lon], zoom_start=13)
|
633 |
-
folium.Marker([lat, lon], popup="You are here!", icon=folium.Icon(color="blue")).add_to(map_)
|
634 |
-
folium_static(map_)
|
635 |
|
636 |
|
637 |
|
|
|
590 |
elif option == "Doctor Connect":
|
591 |
st.subheader("π₯ Find a Doctor Near You")
|
592 |
|
593 |
+
address = st.text_input("Enter your location (City, State or full address):")
|
594 |
+
|
595 |
+
if address:
|
596 |
+
geolocator = Nominatim(user_agent="geoapi")
|
597 |
+
location = geolocator.geocode(address)
|
598 |
+
if location:
|
599 |
+
lat, lon = location.latitude, location.longitude
|
600 |
+
st.success(f"π Location found: {lat:.4f}, {lon:.4f}")
|
601 |
+
map_ = folium.Map(location=[lat, lon], zoom_start=13)
|
602 |
+
folium.Marker([lat, lon], popup="You are here!", icon=folium.Icon(color="blue")).add_to(map_)
|
603 |
+
folium_static(map_)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
604 |
else:
|
605 |
+
st.error("β Could not find location. Please try a more specific address.")
|
606 |
else:
|
607 |
+
st.info("π Please enter your location above to proceed.")
|
608 |
|
|
|
|
|
|
|
|
|
|
|
609 |
|
610 |
|
611 |
|