ajl2718
Fix bug in geocoding function
a2f46b5
raw
history blame
891 Bytes
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()