Pijush2023 commited on
Commit
9e9ae1d
·
verified ·
1 Parent(s): fe0e707

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -348,6 +348,27 @@ def extract_addresses(response):
348
 
349
  all_addresses = []
350
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  def generate_map(location_names):
352
  global all_addresses
353
  all_addresses.extend(location_names)
@@ -355,20 +376,21 @@ def generate_map(location_names):
355
  api_key = os.environ['GOOGLEMAPS_API_KEY']
356
  gmaps = GoogleMapsClient(key=api_key)
357
 
358
- m = folium.Map(location=[33.5175,-86.809444], zoom_start=16)
359
 
360
  for location_name in all_addresses:
361
  geocode_result = gmaps.geocode(location_name)
362
  if geocode_result:
363
  location = geocode_result[0]['geometry']['location']
364
  folium.Marker(
365
- [location['lat'], 'lng'],
366
  tooltip=f"{geocode_result[0]['formatted_address']}"
367
  ).add_to(m)
368
 
369
  map_html = m._repr_html_()
370
  return map_html
371
 
 
372
  def fetch_local_news():
373
  api_key = os.environ['SERP_API']
374
  url = f'https://serpapi.com/search.json?engine=google_news&q=birmingham headline&api_key={api_key}'
 
348
 
349
  all_addresses = []
350
 
351
+ # def generate_map(location_names):
352
+ # global all_addresses
353
+ # all_addresses.extend(location_names)
354
+
355
+ # api_key = os.environ['GOOGLEMAPS_API_KEY']
356
+ # gmaps = GoogleMapsClient(key=api_key)
357
+
358
+ # m = folium.Map(location=[33.5175,-86.809444], zoom_start=16)
359
+
360
+ # for location_name in all_addresses:
361
+ # geocode_result = gmaps.geocode(location_name)
362
+ # if geocode_result:
363
+ # location = geocode_result[0]['geometry']['location']
364
+ # folium.Marker(
365
+ # [location['lat'], 'lng'],
366
+ # tooltip=f"{geocode_result[0]['formatted_address']}"
367
+ # ).add_to(m)
368
+
369
+ # map_html = m._repr_html_()
370
+ # return map_html
371
+
372
  def generate_map(location_names):
373
  global all_addresses
374
  all_addresses.extend(location_names)
 
376
  api_key = os.environ['GOOGLEMAPS_API_KEY']
377
  gmaps = GoogleMapsClient(key=api_key)
378
 
379
+ m = folium.Map(location=[33.5175, -86.809444], zoom_start=16)
380
 
381
  for location_name in all_addresses:
382
  geocode_result = gmaps.geocode(location_name)
383
  if geocode_result:
384
  location = geocode_result[0]['geometry']['location']
385
  folium.Marker(
386
+ [location['lat'], location['lng']],
387
  tooltip=f"{geocode_result[0]['formatted_address']}"
388
  ).add_to(m)
389
 
390
  map_html = m._repr_html_()
391
  return map_html
392
 
393
+
394
  def fetch_local_news():
395
  api_key = os.environ['SERP_API']
396
  url = f'https://serpapi.com/search.json?engine=google_news&q=birmingham headline&api_key={api_key}'