KeshavRa commited on
Commit
ae1873a
·
verified ·
1 Parent(s): 5730654

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -5,6 +5,20 @@ import requests
5
  import os
6
  import math
7
  from openai import OpenAI
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  def call_gpt(user_needs, shelter_services, api_key):
10
  client = OpenAI(api_key = api_key)
@@ -251,6 +265,14 @@ else:
251
 
252
  with tabs[3]:
253
  st.write(shelter['Webpage'])
 
 
 
 
 
 
 
 
254
 
255
  # Create two columns
256
  col1, col2, col3 = st.columns([1,1,1])
 
5
  import os
6
  import math
7
  from openai import OpenAI
8
+ import folium
9
+ from streamlit_folium import folium_static
10
+
11
+ # Reference: https://github.com/sfc38/Google-Maps-API-Streamlit-App/blob/master/google_maps_app.py#L126-L135
12
+ def create_map():
13
+ # Create the map with Google Maps
14
+ map_obj = folium.Map(tiles=None)
15
+ folium.TileLayer("https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}",
16
+ attr="google",
17
+ name="Google Maps",
18
+ overlay=True,
19
+ control=True,
20
+ subdomains=["mt0", "mt1", "mt2", "mt3"]).add_to(map_obj)
21
+ return map_obj
22
 
23
  def call_gpt(user_needs, shelter_services, api_key):
24
  client = OpenAI(api_key = api_key)
 
265
 
266
  with tabs[3]:
267
  st.write(shelter['Webpage'])
268
+
269
+ # Create map for address
270
+ map = create_map()
271
+ geocoding_api_key = os.environ['OpenWeather_API_KEY']
272
+ address = f"{shelter['Address']}, {shelter['City']}, CA"
273
+ coordinates = get_coordinates(address, geocoding_api_key)
274
+ folium.Marker(coordinates, popup=address).add_to(map)
275
+ folium_static(map)
276
 
277
  # Create two columns
278
  col1, col2, col3 = st.columns([1,1,1])