spacy_old / app.py
sitwala's picture
edits
830e17b
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)