Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,6 +28,13 @@ def process_api(input_text):
|
|
| 28 |
return {"result": get_coords(input_text)}
|
| 29 |
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# request_url = 'https://nominatim.openstreetmap.org/search.php?q=Glebe&polygon_geojson=1&accept-language=en&format=jsonv2'
|
| 33 |
# headers = {
|
|
@@ -38,7 +45,7 @@ def process_api(input_text):
|
|
| 38 |
|
| 39 |
# 设置API格式为JSON
|
| 40 |
gr.Interface(
|
| 41 |
-
fn=
|
| 42 |
# fn=cont,
|
| 43 |
inputs="text",
|
| 44 |
outputs="json",
|
|
|
|
| 28 |
return {"result": get_coords(input_text)}
|
| 29 |
|
| 30 |
|
| 31 |
+
request_url = 'https://nominatim.openstreetmap.org/search.php?q=Glebe&polygon_geojson=1&accept-language=en&format=jsonv2'
|
| 32 |
+
headers = {
|
| 33 |
+
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Safari/605.1.15"
|
| 34 |
+
}
|
| 35 |
+
page1 = requests.get(request_url, headers=headers, verify=False)
|
| 36 |
+
cont = page1.content
|
| 37 |
+
|
| 38 |
|
| 39 |
# request_url = 'https://nominatim.openstreetmap.org/search.php?q=Glebe&polygon_geojson=1&accept-language=en&format=jsonv2'
|
| 40 |
# headers = {
|
|
|
|
| 45 |
|
| 46 |
# 设置API格式为JSON
|
| 47 |
gr.Interface(
|
| 48 |
+
fn=cont,
|
| 49 |
# fn=cont,
|
| 50 |
inputs="text",
|
| 51 |
outputs="json",
|