oberbics commited on
Commit
4c0fe2d
·
verified ·
1 Parent(s): 8876c58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -5
app.py CHANGED
@@ -120,7 +120,13 @@ def extract_info(template, text):
120
 
121
  def create_map(df, location_col):
122
  # Initialize map with satellite imagery which shows greenery
123
- m = folium.Map(location=[20, 0], zoom_start=2, control_scale=True)
 
 
 
 
 
 
124
 
125
  # Add the satellite tile layer - this will show green areas
126
  folium.TileLayer(
@@ -356,14 +362,15 @@ with gr.Blocks(css=custom_css) as mapping_interface:
356
  map_output = gr.HTML(
357
  label="Interactive Map",
358
  value="""
359
- <div style="text-align:center; height:70vh; display:flex; align-items:center; justify-content:center;
360
  background-color:#f5f5f5; border:1px solid #e0e0e0; border-radius:8px;">
361
  <div>
362
  <img src="https://cdn-icons-png.flaticon.com/512/854/854878.png" width="100">
363
  <p style="margin-top:20px; color:#666;">Your map will appear here after processing</p>
364
  </div>
365
  </div>
366
- """
 
367
  )
368
  stats_output = gr.Textbox(
369
  label="Location Statistics",
@@ -383,9 +390,19 @@ with gr.Blocks(css=custom_css) as mapping_interface:
383
  map_html, stats, processed_path = process_excel(file, column)
384
 
385
  if map_html and processed_path:
386
- # Create responsive container for the map
387
  responsive_html = f"""
388
- <div style="width:100%; height:70vh; margin:0; padding:0; border:1px solid #e0e0e0; border-radius:8px; overflow:hidden;">
 
 
 
 
 
 
 
 
 
 
389
  {map_html}
390
  </div>
391
  """
 
120
 
121
  def create_map(df, location_col):
122
  # Initialize map with satellite imagery which shows greenery
123
+ m = folium.Map(
124
+ location=[20, 0],
125
+ zoom_start=2,
126
+ control_scale=True,
127
+ width='100%',
128
+ height='100%'
129
+ )
130
 
131
  # Add the satellite tile layer - this will show green areas
132
  folium.TileLayer(
 
362
  map_output = gr.HTML(
363
  label="Interactive Map",
364
  value="""
365
+ <div style="text-align:center; height:70vh; width:100%; display:flex; align-items:center; justify-content:center;
366
  background-color:#f5f5f5; border:1px solid #e0e0e0; border-radius:8px;">
367
  <div>
368
  <img src="https://cdn-icons-png.flaticon.com/512/854/854878.png" width="100">
369
  <p style="margin-top:20px; color:#666;">Your map will appear here after processing</p>
370
  </div>
371
  </div>
372
+ """,
373
+ elem_id="map_container"
374
  )
375
  stats_output = gr.Textbox(
376
  label="Location Statistics",
 
390
  map_html, stats, processed_path = process_excel(file, column)
391
 
392
  if map_html and processed_path:
393
+ # Create responsive container for the map that fills the available space
394
  responsive_html = f"""
395
+ <div style="width:100%; height:70vh; margin:0; padding:0; border:1px solid #e0e0e0; border-radius:8px; overflow:hidden; position:relative;">
396
+ <style>
397
+ /* Fix map sizing issues */
398
+ .leaflet-container {{
399
+ width: 100% !important;
400
+ height: 100% !important;
401
+ position: absolute !important;
402
+ top: 0;
403
+ left: 0;
404
+ }}
405
+ </style>
406
  {map_html}
407
  </div>
408
  """