Spaces:
Running
on
Zero
Running
on
Zero
import gradio as gr | |
from transformers import pipeline | |
get_completion = pipeline("ner", model="dslim/bert-base-NER") | |
def ner(input): | |
output = get_completion(input) | |
return {"text": input, "entities": output} | |
gr.close_all() | |
demo = gr.Interface(fn=ner, | |
inputs=[gr.Textbox(label="Text to find entities", lines=2)], | |
outputs=[gr.HighlightedText(label="Text with entities")], | |
title="Named Entity Recognition - NER ", | |
description="Find entities using the `dslim/bert-base-NER` model under the hood!", | |
allow_flagging="never", | |
#Here we introduce a new tag, examples, easy to use examples for your application | |
examples=["My name is Andrew and I live in California", "My name is Poli and work at HuggingFace"]) | |
demo.launch() |