Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,39 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import spacy
|
| 3 |
-
from transformers import
|
| 4 |
from PIL import Image
|
| 5 |
|
|
|
|
| 6 |
nlp = spacy.load("./models/en_core_web_sm")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
st.title("SpaGAN Demo")
|
| 9 |
st.write("Enter a text, and the system will highlight the geo-entities within it.")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import spacy
|
| 3 |
+
from transformers import BertTokenizer, BertModel
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
+
#LOAD MODEL SECTION#
|
| 7 |
nlp = spacy.load("./models/en_core_web_sm")
|
| 8 |
+
|
| 9 |
+
bert_tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
|
| 10 |
+
bert_model = BertModel.from_pretrained("bert-base-uncased")
|
| 11 |
+
bert_model.eval()
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
|
| 38 |
st.title("SpaGAN Demo")
|
| 39 |
st.write("Enter a text, and the system will highlight the geo-entities within it.")
|