ganeshkamath89's picture
Changing the format to same as Wikipedia Example
dbcb4ce verified
raw
history blame
880 Bytes
import gradio as gr
from transformers import pipeline
def generate_story(story):
ner = pipeline("ner", "dbmdz/bert-large-cased-finetuned-conll03-english")
entities = ner(story)
return str(entities)
demo = gr.Interface (
fn=generate_story,
description="Named Entity Recognition Demo with BERT",
examples=[
["Adventurer is approached by a mysterious stranger in the tavern for a new quest."],
["He didn't remember the last time he had to run this fast as he jumped on to the bus."],
["Fate has it's own plans for the common man, which is why we philosophise on the observationg giving it our own interpretation."],
["The bear reached the river and spotted a school of fish. His hunger started taking its toll."]
],
gr.Text(label="Input Text"),
[
gr.Text(label="Entities")
]
)
demo.launch(share=True)