ajl2718 commited on
Commit
7316a14
·
1 Parent(s): a03887d

Use whereabouts for geocoding

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -1,10 +1,15 @@
1
  import gradio as gr
2
- import duckdb
 
3
 
4
- db = duckdb.connect('test.db')
 
5
 
6
- def greet(name):
7
- return "Hello " + name + "!! There are " + str(db.execute('show tables;').df().shape[0]) + ' tables'
 
 
 
8
 
9
  demo = gr.Interface(fn=greet, inputs="text", outputs="text")
10
  demo.launch()
 
1
  import gradio as gr
2
+ from whereabouts.utils import download
3
+ from whereabouts.Matcher import Matcher
4
 
5
+ # download the address database for all of Australia
6
+ download('au_all_sm', 'saunteringcat/whereabouts-db')
7
 
8
+ # create a matcher object
9
+ matcher = Matcher('au_all_sm')
10
+
11
+ def greet(address):
12
+ return matcher.geocode(address)
13
 
14
  demo = gr.Interface(fn=greet, inputs="text", outputs="text")
15
  demo.launch()