File size: 1,070 Bytes
045dfb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d5df588
 
 
 
 
 
 
 
045dfb0
 
d5df588
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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?",
]

examples_2 = [
    "The Intern was oriented on ICT setup and Infrastructure of Soroti University, drafted workplan and started off the Internship. Simon was encouraged to take the Internship seriously as there was a lot to learn.",
]

examples_3 = [
    "Partially done, expected a better result based on Steven's experienced. More effort needed ...",
]


gr.Interface(ner_spacy, gr.Textbox(placeholder="Enter sentence here..."), 
             gr.HighlightedText(), examples=[[examples],[examples_2],[examples_3],],
    title="Natural Entity Recognition Model by Brian Joram Wandobire",
    description="takes in a comment as an input and outputs the Entities",
    
             ).launch()