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