| import gradio as gr |
| from .map_logic import make_map |
|
|
|
|
| """ def get_map_widgets(city_component): |
| #map_output = gr.HTML(value="Map will appear here once you type a city", elem_id="map-widget") |
| map_output = gr.Plot(label="Map", value=None) |
| show_grid = gr.Checkbox(label="Draw Grid", value=False) |
| show_georef = gr.Checkbox(label="Show Georeferenced Map", value=False) |
| |
| inputs = [city_component, show_grid, show_georef] |
| for comp in inputs: |
| comp.change(fn=make_map, inputs=inputs, outputs=[map_output]) |
| |
| return map_output, show_grid, show_georef """ |
|
|
|
|
| def get_map_widgets(city_component): |
| map_output = gr.Plot(label="Map") |
|
|
| show_grid = gr.Checkbox(label="Draw Grid", value=False) |
| show_georef = gr.Checkbox(label="Show Georeferenced Map", value=False) |
|
|
| inputs = [city_component, show_grid, show_georef] |
|
|
| def update_map(city, grid, georef): |
| return make_map(city, grid, georef) |
|
|
| city_component.change( |
| fn=update_map, |
| inputs=inputs, |
| outputs=map_output |
| ) |
|
|
| show_grid.change( |
| fn=update_map, |
| inputs=inputs, |
| outputs=map_output |
| ) |
|
|
| show_georef.change( |
| fn=update_map, |
| inputs=inputs, |
| outputs=map_output |
| ) |
|
|
| return map_output, show_grid, show_georef |