import gradio as gr #os is used to change the directory import os #spacy is used for the NER import spacy #pandas is used to read, edit, and write tabular data 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 # Using spacy.load(). import spacy from collections import Counter import en_core_web_sm # spacy.cli.download("en_core_web_lg") 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()