sitwala's picture
Duplicate from sitwala/spacy_old
d4efdb8
raw
history blame
498 Bytes
import spacy
import gradio as gr
#spacy download en_core_web_lg
nlp = spacy.load("en_core_web_lg")
def ner(text):
doc = nlp(text)
entities= []
for entity in doc.ents:
word = entity.text
label = entity.label_
entities.append((word,label))
return entities
examples = "Donald Trump is president of America"
demo = gr.Interface(ner,
gr.Textbox(placeholder="Enter sentence here..."),
gr.HighlightedText())
demo.launch(debug = True)