MuntasirHossain's picture
Update app.py
bf20079
raw
history blame
1.32 kB
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 = displacy.render(doc, style="ent", page=True, manual=True, minify=True)
html = (
"<div style='max-width:100%; max-height:360px; overflow:auto'>"
+ html
+ "</div>"
)
return html
demo = gr.Interface(
ner,
gr.Textbox(placeholder="Enter sentence here..."),
outputs="html",
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.[22][17] \
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.[23] A fourth round worth $45 million in May 2007 brought the total private financing investment to over $105 million.[23] \
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.[24]"]
)
demo.launch()