Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
ajl2718
commited on
Commit
·
e905680
1
Parent(s):
c4e3285
Update default value for geocoder database and addresses
Browse files
app.py
CHANGED
@@ -18,6 +18,13 @@ matcher4 = Matcher('au_nsw_lg')
|
|
18 |
matcher5 = Matcher('us_ca_sm')
|
19 |
matcher6 = Matcher('us_ma_sm')
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
# function to geocode results
|
22 |
def geocode(addresses, db_name='au_all_sm', how='standard'):
|
23 |
if db_name == 'au_all_sm':
|
@@ -66,7 +73,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
66 |
("New South Wales, Australia - Large", "au_nsw_lg"),
|
67 |
("California - Small", "us_ca_sm"),
|
68 |
("Massachusetts - Small", "us_ma_sm")],
|
69 |
-
value="
|
70 |
multiselect=False,
|
71 |
label="Database",
|
72 |
info="Select from one of the geocoding databases based on country, region and size")
|
@@ -74,7 +81,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
74 |
value='standard',
|
75 |
label="Matching algorithm",
|
76 |
info="Trigram matching is more accurate but slower. Only available for the large databases.")
|
77 |
-
text_input = gr.Textbox(lines=2, label="Addresses to geocode (one row per address)")
|
78 |
geocode_button = gr.Button(variant='primary')
|
79 |
json_output = gr.JSON(label="Output JSON data")
|
80 |
geocode_button.click(fn=geocode, inputs=[text_input, dropdown_choice, radio_choice], outputs=json_output, api_name="whereabouts_geocoder")
|
|
|
18 |
matcher5 = Matcher('us_ca_sm')
|
19 |
matcher6 = Matcher('us_ma_sm')
|
20 |
|
21 |
+
default_address_values = """
|
22 |
+
3333 Channel Way, San Diego, CA
|
23 |
+
1500 Orange Avenuee, Colonado, CA
|
24 |
+
3129 Arden Wy, Sacramento, 95825
|
25 |
+
2000 Allston Way, Berkly, 94704
|
26 |
+
"""
|
27 |
+
|
28 |
# function to geocode results
|
29 |
def geocode(addresses, db_name='au_all_sm', how='standard'):
|
30 |
if db_name == 'au_all_sm':
|
|
|
73 |
("New South Wales, Australia - Large", "au_nsw_lg"),
|
74 |
("California - Small", "us_ca_sm"),
|
75 |
("Massachusetts - Small", "us_ma_sm")],
|
76 |
+
value="us_ca_sm",
|
77 |
multiselect=False,
|
78 |
label="Database",
|
79 |
info="Select from one of the geocoding databases based on country, region and size")
|
|
|
81 |
value='standard',
|
82 |
label="Matching algorithm",
|
83 |
info="Trigram matching is more accurate but slower. Only available for the large databases.")
|
84 |
+
text_input = gr.Textbox(lines=2, label="Addresses to geocode (one row per address)", value=default_address_values)
|
85 |
geocode_button = gr.Button(variant='primary')
|
86 |
json_output = gr.JSON(label="Output JSON data")
|
87 |
geocode_button.click(fn=geocode, inputs=[text_input, dropdown_choice, radio_choice], outputs=json_output, api_name="whereabouts_geocoder")
|