Spaces:
Runtime error
Runtime error
Atharva
commited on
Commit
•
f441aa5
1
Parent(s):
7711cb9
pipeline update
Browse files
README.md
CHANGED
@@ -6,7 +6,7 @@ colorTo: purple
|
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.2.0
|
8 |
app_file: app.py
|
9 |
-
models: ["
|
10 |
pinned: false
|
11 |
license: mit
|
12 |
---
|
|
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.2.0
|
8 |
app_file: app.py
|
9 |
+
models: ["Jean-Baptiste/roberta-large-ner-english"]
|
10 |
pinned: false
|
11 |
license: mit
|
12 |
---
|
app.py
CHANGED
@@ -27,8 +27,8 @@ COLOR = {
|
|
27 |
@st.cache(allow_output_mutation=True, show_spinner=True)
|
28 |
def load_models():
|
29 |
# NER
|
30 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
31 |
-
bert_ner = AutoModelForTokenClassification.from_pretrained("
|
32 |
tagger = pipeline("token-classification", model=bert_ner, tokenizer=tokenizer,
|
33 |
device=-1, aggregation_strategy="average")
|
34 |
# NED
|
@@ -54,8 +54,8 @@ def get_candidates(mentions_tags):
|
|
54 |
if (mention, tag) in cache.keys():
|
55 |
candidates.append((mention, cache[(mention, tag)]))
|
56 |
else:
|
57 |
-
res1 = google_search(mention + TYPE[tag], limit=
|
58 |
-
res2 = wikipedia_search(mention, limit=
|
59 |
cands = list(set(res1 + res2))
|
60 |
cache[(mention, tag)] = cands
|
61 |
candidates.append((mention, cands))
|
|
|
27 |
@st.cache(allow_output_mutation=True, show_spinner=True)
|
28 |
def load_models():
|
29 |
# NER
|
30 |
+
tokenizer = AutoTokenizer.from_pretrained("Jean-Baptiste/roberta-large-ner-english")
|
31 |
+
bert_ner = AutoModelForTokenClassification.from_pretrained("Jean-Baptiste/roberta-large-ner-english")
|
32 |
tagger = pipeline("token-classification", model=bert_ner, tokenizer=tokenizer,
|
33 |
device=-1, aggregation_strategy="average")
|
34 |
# NED
|
|
|
54 |
if (mention, tag) in cache.keys():
|
55 |
candidates.append((mention, cache[(mention, tag)]))
|
56 |
else:
|
57 |
+
res1 = google_search(mention + TYPE[tag], limit=3)
|
58 |
+
res2 = wikipedia_search(mention, limit=3)
|
59 |
cands = list(set(res1 + res2))
|
60 |
cache[(mention, tag)] = cands
|
61 |
candidates.append((mention, cands))
|