Spaces:
Sleeping
Sleeping
raul-padua
commited on
Commit
•
9f96e9d
1
Parent(s):
e3560d0
Upload 2 files
Browse filesapp.py and requirements.txt files.
- app.py +19 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
get_completion = pipeline("ner", model="dslim/bert-base-NER")
|
5 |
+
|
6 |
+
def ner(input):
|
7 |
+
output = get_completion(input)
|
8 |
+
return {"text": input, "entities": output}
|
9 |
+
|
10 |
+
gr.close_all()
|
11 |
+
demo = gr.Interface(fn=ner,
|
12 |
+
inputs=[gr.Textbox(label="Text to find entities", lines=2)],
|
13 |
+
outputs=[gr.HighlightedText(label="Text with entities")],
|
14 |
+
title="NER with dslim/bert-base-NER",
|
15 |
+
description="Find entities using the `BERT-base` model under the hood!",
|
16 |
+
allow_flagging="never",
|
17 |
+
#Here we introduce a new tag, examples, easy to use examples for your application
|
18 |
+
examples=["My name is Raul and I live in Niterói, Rio de Janeiro, Brazil"])
|
19 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
gradio
|
3 |
+
torch
|