MuntasirHossain's picture
Update app.py
c0fcdfe
import gradio as gr
import os
os.system('python -m spacy download en_core_web_trf')
import spacy
from spacy import displacy
nlp = spacy.load("en_core_web_trf")
def ner(text):
doc = nlp(text)
html = displacy.render(doc, style="ent", page=True)
html = (
""
+ html
+ ""
)
return html
title = "Named Entity Recognition"
demo = gr.Interface(
fn=ner,
inputs=gr.Textbox(placeholder="Enter sentence here..."),
outputs="html",
title=title,
examples=["In February 2006, Musk led Tesla's Series B venture capital funding round of $13 million, which added Valor Equity Partners to the funding team. \
Musk co-led the third, $40 million round in May 2006 which saw investment from prominent entrepreneurs including Google co-founders Sergey Brin and Larry Page, \
and former eBay President Jeff Skoll. A fourth round worth $45 million in May 2007 brought the total private financing investment to over $105 million. \
Tesla's first car, the Roadster, was officially revealed to the public on July 19, 2006, in Santa Monica, California, at a 350-person invitation-only event held \
in Barker Hangar at Santa Monica Airport."]
)
demo.launch()