|
import gradio as gr |
|
|
|
import os |
|
|
|
import spacy |
|
|
|
import pandas as pd |
|
pip install https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whl |
|
|
|
|
|
|
|
import spacy |
|
|
|
from collections import Counter |
|
import en_core_web_sm |
|
|
|
nlp = en_core_web_sm.load() |
|
|
|
|
|
nlp = spacy.load("en_core_web_sm") |
|
def ner(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?", |
|
] |
|
|
|
|
|
iface=gr.Interface(ner, gr.Textbox(placeholder="Enter sentence here..."), |
|
gr.HighlightedText(), examples=examples) |
|
iface.launch() |