Spaces:
Runtime error
Runtime error
| 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() |