File size: 1,291 Bytes
16a059c
2d329a0
f8b90ea
030dcfe
3c0bac4
95327ef
 
f8b90ea
 
 
 
 
 
 
3c0bac4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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