awacke1 commited on
Commit
161f699
·
1 Parent(s): d868fa2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -16,10 +16,15 @@ def update_map(csv_file):
16
  return df, Folium(value=Map(location=[df.iloc[0]['Latitude'], df.iloc[0]['Longitude']], zoom_start=10), height=400)
17
 
18
  # Function to update location on map based on selected data row
19
- def select(data: gr.Dataframe):
20
  row = data.iloc[0, :]
21
  return Map(location=[row['Latitude'], row['Longitude']], zoom_start=10)
22
 
 
 
 
 
 
23
  # Gradio Blocks
24
  with gr.Blocks() as demo:
25
  gr.Markdown("# 🗺️ Explore AI Data Maps with Gradio and Folium\n"
 
16
  return df, Folium(value=Map(location=[df.iloc[0]['Latitude'], df.iloc[0]['Longitude']], zoom_start=10), height=400)
17
 
18
  # Function to update location on map based on selected data row
19
+ def select2(data: gr.Dataframe):
20
  row = data.iloc[0, :]
21
  return Map(location=[row['Latitude'], row['Longitude']], zoom_start=10)
22
 
23
+ # select function with input dataframe and data where gradio Selects the Data then put data index 0 into df.iloc, then Map that location
24
+ def select(df, data: gr.SelectData):
25
+ row = df.iloc[data.index[0], :]
26
+ return Map(location=[row['Latitude'], row['Longitude']])
27
+
28
  # Gradio Blocks
29
  with gr.Blocks() as demo:
30
  gr.Markdown("# 🗺️ Explore AI Data Maps with Gradio and Folium\n"