Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
ner_pipeline = pipeline("ner")
|
6 |
+
|
7 |
+
examples = [
|
8 |
+
"Does Chicago have any stores and does Joe live here?",
|
9 |
+
]
|
10 |
+
|
11 |
+
def ner(text):
|
12 |
+
output = ner_pipeline(text)
|
13 |
+
return {"text": text, "entities": output}
|
14 |
+
|
15 |
+
gr.Interface(ner,
|
16 |
+
gr.Textbox(placeholder="Enter sentence here..."),
|
17 |
+
gr.HighlightedText(),
|
18 |
+
examples=examples).launch()
|