Skip to content

Commit 41143ba

Browse files
committed
updated maps and code
1 parent e218aff commit 41143ba

File tree

4 files changed

+52
-52
lines changed

4 files changed

+52
-52
lines changed

About.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def load_lottieurl(url):
1111

1212

1313
st.set_page_config(
14-
page_title="Skin Cancer",
14+
page_title="Diagnose",
1515
page_icon="♋",
1616
layout="wide",
1717
initial_sidebar_state="expanded",
@@ -70,7 +70,7 @@ def load_lottieurl(url):
7070
Our application utilizes machine learning to predict what skin disease you may have, from just your skin images!
7171
We then recommend you specialized doctors based on your type of disease, if our model predicts you're healthy we'll suggest you a general doctor.
7272
##
73-
[Learn More >](https://youtu.be/sFIXmJn3vGk)
73+
[Learn More >]()
7474
"""
7575
with cols[1]:
7676
st_lottie(lottie_healthy, height=300, key="healthy")

pages/2_Demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import tensorflow as tf
66

77
st.set_page_config(
8-
page_title="Skin Cancer Detection",
8+
page_title="Diagnose Demo",
99
page_icon="♋",
1010
layout="centered",
1111
initial_sidebar_state="expanded",

pages/3_Contact.py

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
11
# Contact Feature
22

33
import streamlit as st
4-
from geopy.geocoders import Nominatim
4+
import pandas as pd
5+
import pydeck as pdk
56
import requests
67

78
st.set_page_config(
8-
page_title="Skin Cancer",
9+
page_title="Diagnose",
910
page_icon="♋",
1011
layout="centered",
1112
initial_sidebar_state="expanded",
1213
)
1314

14-
# Replace YOUR_API_KEY with your actual API key
15-
api_key = st.secrets["api_key"]
16-
1715

1816
st.title("Find a dermatologist")
19-
# Set the location and radius for the search
17+
18+
# Create a function to search for nearby doctors based on city name
19+
def search_doctors(city):
20+
# Google Maps API key
21+
api_key = st.secrets["API_KEY"]
22+
url = f"https://maps.googleapis.com/maps/api/place/textsearch/json?query=dermatologists+in+{city}&key={api_key}"
23+
results = requests.get(url).json()
24+
return results["results"]
25+
26+
27+
# Input city name
2028
city = st.text_input(
2129
label="Enter your city",
2230
placeholder="City (e.g. New Delhi)",
2331
help="Enter the name of the city where you want to find a dermatologist",
2432
).strip()
2533

26-
if city != "":
27-
# Create a geolocator object
28-
geolocator = Nominatim(user_agent="skin_cancer")
29-
30-
# Use the geolocator to get the latitude and longitude of the city
31-
location = geolocator.geocode(city)
32-
latitude = location.latitude
33-
longitude = location.longitude
34-
35-
location = f"{latitude},{longitude}"
36-
radius = 10000 # 10 km
37-
keyword = "dermatologist"
38-
39-
# Make the request to the Places API
40-
url = f"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location={location}&radius={radius}&keyword={keyword}&key={api_key}"
41-
response = requests.get(url)
42-
results = response.json()["results"]
43-
44-
# Extract the place IDs of the results
45-
place_ids = [result["place_id"] for result in results]
34+
if city:
35+
# Search for nearby doctors
36+
doctors = search_doctors(city)
4637

47-
# Use the place IDs to get the details of the places
48-
dermatologists = []
49-
for place_id in place_ids:
50-
url = f"https://maps.googleapis.com/maps/api/place/details/json?place_id={place_id}&key={api_key}"
51-
response = requests.get(url)
52-
place_details = response.json()["result"]
53-
dermatologists.append(
54-
{
55-
"name": place_details["name"],
56-
"address": place_details["formatted_address"],
57-
}
38+
# Display the results to the user
39+
st.write("Results for Dermatologist doctors in: ", city)
40+
lat_long = [
41+
(doc["geometry"]["location"]["lat"], doc["geometry"]["location"]["lng"])
42+
for doc in doctors
43+
]
44+
df = pd.DataFrame(lat_long, columns=["latitude", "longitude"])
45+
st.pydeck_chart(
46+
pdk.Deck(
47+
map_style="mapbox://styles/mapbox/streets-v12",
48+
initial_view_state=pdk.ViewState(
49+
latitude=df["latitude"].mean(),
50+
longitude=df["longitude"].mean(),
51+
zoom=11,
52+
pitch=50,
53+
),
54+
layers=[
55+
pdk.Layer(
56+
"ScatterplotLayer",
57+
data=df,
58+
get_position=["longitude", "latitude"],
59+
get_radius=100,
60+
get_color=[200, 30, 0],
61+
pickable=True,
62+
auto_highlight=True,
63+
)
64+
],
5865
)
66+
)
5967

60-
# Display the results in Streamlit
61-
st.header("Results")
62-
for i, dermatologist in enumerate(dermatologists, start=1):
63-
# st.markdown(f"**{dermatologist['name']}**")
64-
# st.markdown(dermatologist["address"])
65-
st.markdown(
66-
f"""
67-
{i}. **{dermatologist['name']}**
68-
> **Address:** {dermatologist['address']}
69-
"""
70-
)
68+
for i, doctor in enumerate(doctors):
69+
st.write(f"{i+1}. **Name**: ", doctor["name"])
70+
st.write("> **Address**: ", doctor["formatted_address"])

pages/4_Articles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from streamlit_lottie import st_lottie
77

88
st.set_page_config(
9-
page_title="Skin Cancer",
9+
page_title="Diagnose",
1010
page_icon="♋",
1111
layout="wide",
1212
initial_sidebar_state="expanded",

0 commit comments

Comments
 (0)