Spaces:
Sleeping
Sleeping
File size: 498 Bytes
d4efdb8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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) |