spacy_ner_v1 / app.py
brijw's picture
Update app.py
045dfb0
raw
history blame
528 Bytes
import gradio as gr
#os is used to change the directory
#spacy is used for the NER
import spacy
from spacy import displacy
import en_core_web_sm
nlp = spacy.load("en_core_web_sm")
def ner_spacy(sentence):
doc = nlp(sentence)
ents = [(e.text, e.label_) for e in doc.ents]
return ents
examples = [
"where did Wandobire's laptop come from, was it africa or uganda?",
]
gr.Interface(ner_spacy, gr.Textbox(placeholder="Enter sentence here..."),
gr.HighlightedText(), examples=examples).launch(share=True)