Spaces:
Sleeping
Sleeping
Upload with huggingface_hub
Browse files- README.md +6 -6
- app.py +21 -0
- requirements.txt +2 -0
README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.3.1
|
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
+
|
2 |
---
|
3 |
+
title: ner_pipeline
|
4 |
+
emoji: 🔥
|
5 |
+
colorFrom: indigo
|
6 |
+
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
sdk_version: 3.3.1
|
9 |
+
|
10 |
app_file: app.py
|
11 |
pinned: false
|
12 |
---
|
|
|
|
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
demo = gr.Interface(ner,
|
16 |
+
gr.Textbox(placeholder="Enter sentence here..."),
|
17 |
+
gr.HighlightedText(),
|
18 |
+
examples=examples)
|
19 |
+
|
20 |
+
if __name__ == "__main__":
|
21 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
transformers
|