Atharva commited on
Commit
f441aa5
1 Parent(s): 7711cb9

pipeline update

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +4 -4
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: ["dslim/bert-base-NER"]
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("dslim/bert-base-NER")
31
- bert_ner = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
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=1)
58
- res2 = wikipedia_search(mention, limit=5)
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))