Spaces:
Sleeping
Sleeping
JasonTPhillipsJr
commited on
Commit
•
bec805a
1
Parent(s):
b14ffe5
Update app.py
Browse files
app.py
CHANGED
@@ -138,8 +138,8 @@ def processSpatialEntities(review, nlp):
|
|
138 |
st.write("Geo-Entity Found in review: ", text)
|
139 |
|
140 |
token_embeddings = torch.stack(token_embeddings, dim=0)
|
141 |
-
processed_embedding = token_embeddings.mean(dim=0
|
142 |
-
|
143 |
return processed_embedding
|
144 |
|
145 |
|
@@ -186,13 +186,10 @@ selected_review = example_reviews[user_input]
|
|
186 |
if st.button("Highlight Geo-Entities"):
|
187 |
if selected_review.strip():
|
188 |
bert_embedding = get_bert_embedding(selected_review)
|
189 |
-
|
190 |
-
st.write("Embedding Shape:", bert_embedding.shape)
|
191 |
|
192 |
-
# Debug: Print the embeddings themselves (optional)
|
193 |
-
#st.write("Embeddings:", bert_embedding)
|
194 |
-
|
195 |
spaBert_embedding = processSpatialEntities(selected_review,nlp)
|
|
|
196 |
|
197 |
#combine the embeddings (NOTE: come back and update after testing)
|
198 |
combined_embedding = torch.cat((bert_embedding,spaBERT_embeddings[0]),dim=-1)
|
|
|
138 |
st.write("Geo-Entity Found in review: ", text)
|
139 |
|
140 |
token_embeddings = torch.stack(token_embeddings, dim=0)
|
141 |
+
processed_embedding = token_embeddings.mean(dim=0) # Shape: (768)
|
142 |
+
processed_embedding = processed_embedding.unsqueeze(0) # Shape: (1, 768)
|
143 |
return processed_embedding
|
144 |
|
145 |
|
|
|
186 |
if st.button("Highlight Geo-Entities"):
|
187 |
if selected_review.strip():
|
188 |
bert_embedding = get_bert_embedding(selected_review)
|
189 |
+
st.write("Review Embedding Shape:", bert_embedding.shape)
|
|
|
190 |
|
|
|
|
|
|
|
191 |
spaBert_embedding = processSpatialEntities(selected_review,nlp)
|
192 |
+
st.write("Geo-Entities embedding shape: ", spaBert_embedding.shape)
|
193 |
|
194 |
#combine the embeddings (NOTE: come back and update after testing)
|
195 |
combined_embedding = torch.cat((bert_embedding,spaBERT_embeddings[0]),dim=-1)
|