Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ from transformers import PretrainedConfig, PreTrainedModel, T5EncoderModel, Auto
|
|
4 |
import torch
|
5 |
import torch.nn as nn
|
6 |
import copy
|
|
|
7 |
|
8 |
keep_layer_count=6
|
9 |
byt5_tokenizer = AutoTokenizer.from_pretrained("yachay/byt5-geotagging-es", token="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")
|
@@ -85,4 +86,28 @@ st.title('GeoTagging using ByT5')
|
|
85 |
text_input = st.text_input('Enter your text:')
|
86 |
if text_input:
|
87 |
location = geolocate_text_byt5(text_input)
|
88 |
-
st.write('Predicted Location: ', location)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
import torch
|
5 |
import torch.nn as nn
|
6 |
import copy
|
7 |
+
import pydeck as pdk
|
8 |
|
9 |
keep_layer_count=6
|
10 |
byt5_tokenizer = AutoTokenizer.from_pretrained("yachay/byt5-geotagging-es", token="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")
|
|
|
86 |
text_input = st.text_input('Enter your text:')
|
87 |
if text_input:
|
88 |
location = geolocate_text_byt5(text_input)
|
89 |
+
st.write('Predicted Location: ', location)
|
90 |
+
# Render map with pydeck
|
91 |
+
map_data = pd.DataFrame(
|
92 |
+
[[location[0], location[1]]],
|
93 |
+
columns=["lat", "lon"]
|
94 |
+
)
|
95 |
+
|
96 |
+
st.pydeck_chart(pdk.Deck(
|
97 |
+
map_style='mapbox://styles/mapbox/light-v9',
|
98 |
+
initial_view_state=pdk.ViewState(
|
99 |
+
latitude=location[0],
|
100 |
+
longitude=location[1],
|
101 |
+
zoom=11,
|
102 |
+
pitch=50,
|
103 |
+
),
|
104 |
+
layers=[
|
105 |
+
pdk.Layer(
|
106 |
+
'ScatterplotLayer',
|
107 |
+
data=map_data,
|
108 |
+
get_position='[lon, lat]',
|
109 |
+
get_color='[200, 30, 0, 160]',
|
110 |
+
get_radius=200,
|
111 |
+
),
|
112 |
+
],
|
113 |
+
))
|