Update app.py
Browse files
app.py
CHANGED
@@ -587,32 +587,36 @@ elif option == "Symptom Checker":
|
|
587 |
st.write(response.content if hasattr(response, "content") else str(response))
|
588 |
|
589 |
|
590 |
-
elif option == "
|
591 |
-
st.subheader("
|
592 |
-
|
593 |
-
|
|
|
|
|
|
|
|
|
594 |
|
595 |
-
if st.button("Locate Me"):
|
596 |
-
if address.strip() != "":
|
597 |
-
try:
|
598 |
-
geolocator = Nominatim(user_agent="geoapi")
|
599 |
-
location = geolocator.geocode(address)
|
600 |
-
|
601 |
-
if location:
|
602 |
-
lat, lon = location.latitude, location.longitude
|
603 |
-
st.success(f"π Location found: {lat:.4f}, {lon:.4f}")
|
604 |
-
|
605 |
-
# Display the map with marker
|
606 |
-
map_ = folium.Map(location=[lat, lon], zoom_start=13)
|
607 |
-
folium.Marker([lat, lon], popup="You are here!", icon=folium.Icon(color="blue")).add_to(map_)
|
608 |
-
folium_static(map_)
|
609 |
-
else:
|
610 |
-
st.error("β Could not find location. Please enter a more specific address.")
|
611 |
-
except Exception as e:
|
612 |
-
st.error(f"β οΈ An error occurred while fetching the location: {str(e)}")
|
613 |
-
else:
|
614 |
-
st.warning("β οΈ Please enter a valid address before clicking 'Locate Me'.")
|
615 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
616 |
|
617 |
|
618 |
|
|
|
587 |
st.write(response.content if hasattr(response, "content") else str(response))
|
588 |
|
589 |
|
590 |
+
elif option == "Symptom Checker":
|
591 |
+
st.subheader("π AI Symptom Checker")
|
592 |
+
st.write("Find possible diseases based on symptoms.")
|
593 |
+
symptoms = st.text_area("Enter symptoms separated by commas:")
|
594 |
+
if st.button("Check Symptoms"):
|
595 |
+
symptom_query = f"Analyze these symptoms: {symptoms}. List possible diseases."
|
596 |
+
response = llm.invoke(symptom_query)
|
597 |
+
st.write(response.content if hasattr(response, "content") else str(response))
|
598 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
599 |
|
600 |
+
elif option == "Doctor Connect":
|
601 |
+
st.subheader("π₯ Find a Doctor Near You")
|
602 |
+
lat, lon = get_user_location()
|
603 |
+
|
604 |
+
if lat is None or lon is None:
|
605 |
+
st.warning("Unable to fetch location. Please allow location access or enter manually.")
|
606 |
+
address = st.text_input("Enter your location (City, State or Latitude, Longitude):")
|
607 |
+
if address:
|
608 |
+
geolocator = Nominatim(user_agent="geoapi")
|
609 |
+
location = geolocator.geocode(address)
|
610 |
+
if location:
|
611 |
+
lat, lon = location.latitude, location.longitude
|
612 |
+
else:
|
613 |
+
st.error("Invalid address! Try again.")
|
614 |
+
|
615 |
+
if lat and lon:
|
616 |
+
st.success(f"π Location detected: {lat}, {lon}")
|
617 |
+
map_ = folium.Map(location=[lat, lon], zoom_start=13)
|
618 |
+
folium.Marker([lat, lon], popup="You are here!", icon=folium.Icon(color="blue")).add_to(map_)
|
619 |
+
folium_static(map_)
|
620 |
|
621 |
|
622 |
|