import spacy import gradio as gr #spacy download en_core_web_lg nlp = spacy.load("en_core_web_lg") def ner(text): doc = nlp(text) entities= [] for entity in doc.ents: word = entity.text label = entity.label_ entities.append((word,label)) return entities examples = "Donald Trump is president of America" demo = gr.Interface(ner, gr.Textbox(placeholder="Enter sentence here..."), gr.HighlightedText()) demo.launch(debug = True)