Spaces:
Sleeping
Sleeping
Ludovic Moncla
commited on
Commit
·
191af2e
1
Parent(s):
12ffcd6
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,22 +21,42 @@ def extract_coordinates(text):
|
|
| 21 |
else:
|
| 22 |
return "No coordinates found"
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
with gr.Blocks() as demo:
|
| 25 |
gr.Markdown("## Geographic Coordinate Extractor (CamemBERT NER Demo)")
|
| 26 |
|
| 27 |
with gr.Row():
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
# Launch
|
| 42 |
if __name__ == "__main__":
|
|
|
|
| 21 |
else:
|
| 22 |
return "No coordinates found"
|
| 23 |
|
| 24 |
+
|
| 25 |
+
examples = [
|
| 26 |
+
"L’adresse est 48.8584, 2.2945 près de la Tour Eiffel.",
|
| 27 |
+
"La latitude est 40.7128 et la longitude est -74.0060 pour New York.",
|
| 28 |
+
"Les coordonnées du Colisée sont 41.8902, 12.4922.",
|
| 29 |
+
"À Rio de Janeiro : -22.9068, -43.1729.",
|
| 30 |
+
"Sydney se situe à -33.8688, 151.2093.",
|
| 31 |
+
"Le Mont Fuji se trouve à 35.3606, 138.7274."
|
| 32 |
+
]
|
| 33 |
+
|
| 34 |
+
|
| 35 |
with gr.Blocks() as demo:
|
| 36 |
gr.Markdown("## Geographic Coordinate Extractor (CamemBERT NER Demo)")
|
| 37 |
|
| 38 |
with gr.Row():
|
| 39 |
+
with gr.Column():
|
| 40 |
+
inp = gr.Textbox(
|
| 41 |
+
label="Enter text",
|
| 42 |
+
placeholder="e.g. * AACH ou ACH, s. f. petite ville d'Allemagne dans le cercle de Souabe, près de la source de l'Aach. Long. 26. 57. lat. 47. 55.",
|
| 43 |
+
lines=3
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
run_btn = gr.Button("Extract & Show")
|
| 47 |
+
run_btn.click(fn=extract_coordinates, inputs=inp, outputs=out_text)
|
| 48 |
|
| 49 |
+
with gr.Column():
|
| 50 |
+
out_text = gr.Textbox(label="Extracted coordinates")
|
| 51 |
+
#out_map = gr.Map(label="Location on Map")
|
| 52 |
|
| 53 |
+
with gr.Row():
|
| 54 |
+
|
| 55 |
+
gr.Examples(
|
| 56 |
+
examples=examples,
|
| 57 |
+
inputs=inp,
|
| 58 |
+
label="Examples"
|
| 59 |
+
)
|
| 60 |
|
| 61 |
# Launch
|
| 62 |
if __name__ == "__main__":
|