Spaces:
Runtime error
Runtime error
Atharva
commited on
Commit
•
3befa47
1
Parent(s):
dd6479e
pipeline update
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import pandas as pd
|
|
2 |
import streamlit as st
|
3 |
from transformers import AutoModelForTokenClassification, AutoTokenizer, pipeline
|
4 |
|
5 |
-
from src import GBRT,
|
6 |
|
7 |
TYPE = {
|
8 |
'LOC': ' location',
|
@@ -53,9 +53,8 @@ def get_candidates(mentions_tags):
|
|
53 |
candidates.append((mention, cache[(mention, tag)]))
|
54 |
else:
|
55 |
cands = wikidata_search(mention, limit=3)
|
56 |
-
cands
|
57 |
-
|
58 |
-
cands = wikipedia_search(mention, limit=3)
|
59 |
cache[(mention, tag)] = cands
|
60 |
candidates.append((mention, cands))
|
61 |
print(mention, cands)
|
|
|
2 |
import streamlit as st
|
3 |
from transformers import AutoModelForTokenClassification, AutoTokenizer, pipeline
|
4 |
|
5 |
+
from src import GBRT, wikidata_search, google_search
|
6 |
|
7 |
TYPE = {
|
8 |
'LOC': ' location',
|
|
|
53 |
candidates.append((mention, cache[(mention, tag)]))
|
54 |
else:
|
55 |
cands = wikidata_search(mention, limit=3)
|
56 |
+
if cands == [] and tag != 'PER':
|
57 |
+
cands = google_search(mention, limit=3)
|
|
|
58 |
cache[(mention, tag)] = cands
|
59 |
candidates.append((mention, cands))
|
60 |
print(mention, cands)
|