Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
from geopy.geocoders import Nominatim
|
4 |
+
geolocator = Nominatim(user_agent="my-custom-user-agent")
|
5 |
+
|
6 |
+
def geocoding(address):
|
7 |
+
location = geolocator.geocode(address)
|
8 |
+
return location.latitude, location.longitude
|
9 |
+
|
10 |
+
|
11 |
+
# Create a Gradio interface
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=geocoding, # Specify your custom function
|
14 |
+
inputs="text", # Input type (text in this example)
|
15 |
+
outputs="text" # Output type (text in this example)
|
16 |
+
)
|
17 |
+
|
18 |
+
# Launch the Gradio interface
|
19 |
+
iface.launch()
|