File size: 891 Bytes
49c9801
7316a14
 
6961bab
99d5451
7316a14
99d5451
 
 
49c9801
7316a14
 
 
0fda97d
 
a2f46b5
49c9801
0fda97d
 
 
 
 
 
 
 
a2f46b5
0fda97d
 
 
49c9801
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
import gradio as gr
from whereabouts.utils import download
from whereabouts.Matcher import Matcher

# download the various address databases
download('au_all_sm', 'saunteringcat/whereabouts-db')
download('au_all_lg', 'saunteringcat/whereabouts-db')
download('au_vic_lg', 'saunteringcat/whereabouts-db')
download('au_nsw_lg', 'saunteringcat/whereabouts-db')

# create a matcher object
matcher = Matcher('au_all_sm')

# function to geocode results
def geocode(addresses):
    return matcher.geocode(addresses)

text_input = gr.Textbox(lines=2, label="Addresses to geocode (one row per address)")
json_output = gr.JSON(label="Output JSON data")

interface_geocoder = gr.Interface(
    fn=geocode,
    inputs=[text_input],
    outputs=[json_output],
    title="Geocoder",
    description="Enter a list of addresses"
)

demo = gr.TabbedInterface([interface_geocoder], ["Geocoding"])
demo.launch()