Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -125,8 +125,9 @@ def processSpatialEntities(review, nlp):
|
|
| 125 |
# Iterate over each entity span and process only geo entities
|
| 126 |
for start, end, text, label in entity_spans:
|
| 127 |
if label in ['FAC', 'ORG', 'LOC', 'GPE']: # Filter to geo-entities
|
| 128 |
-
spaBert_emb = get_spaBert_embedding(text)
|
| 129 |
-
token_embeddings.append((text, spaBert_emb))
|
|
|
|
| 130 |
return token_embeddings
|
| 131 |
|
| 132 |
# Function to read reviews from a text file
|
|
@@ -184,7 +185,9 @@ if st.button("Highlight Geo-Entities"):
|
|
| 184 |
st.write("Embedding Shape:", bert_embedding.shape)
|
| 185 |
|
| 186 |
# Debug: Print the embeddings themselves (optional)
|
| 187 |
-
st.write("Embeddings:", bert_embedding)
|
|
|
|
|
|
|
| 188 |
|
| 189 |
#combine the embeddings (NOTE: come back and update after testing)
|
| 190 |
combined_embedding = torch.cat((bert_embedding,spaBERT_embeddings[0]),dim=-1)
|
|
|
|
| 125 |
# Iterate over each entity span and process only geo entities
|
| 126 |
for start, end, text, label in entity_spans:
|
| 127 |
if label in ['FAC', 'ORG', 'LOC', 'GPE']: # Filter to geo-entities
|
| 128 |
+
#spaBert_emb = get_spaBert_embedding(text)
|
| 129 |
+
#token_embeddings.append((text, spaBert_emb))
|
| 130 |
+
st.write("Geo-Entity Found in review: ", text)
|
| 131 |
return token_embeddings
|
| 132 |
|
| 133 |
# Function to read reviews from a text file
|
|
|
|
| 185 |
st.write("Embedding Shape:", bert_embedding.shape)
|
| 186 |
|
| 187 |
# Debug: Print the embeddings themselves (optional)
|
| 188 |
+
#st.write("Embeddings:", bert_embedding)
|
| 189 |
+
|
| 190 |
+
spaBert_embedding = processSpatialEntities(selected_review,nlp)
|
| 191 |
|
| 192 |
#combine the embeddings (NOTE: come back and update after testing)
|
| 193 |
combined_embedding = torch.cat((bert_embedding,spaBERT_embeddings[0]),dim=-1)
|