MayankGupta06 commited on
Commit
9afdc38
Β·
verified Β·
1 Parent(s): d1d4390

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -24
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 == "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 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