Spaces:
Running
Running
Mike
commited on
Commit
·
317026d
1
Parent(s):
c7eacfd
Add skill extraction demo
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
token_classifier = pipeline(model="jjzha/jobbert_skill_extraction", aggregation_strategy="simple")
|
| 5 |
+
|
| 6 |
+
examples = [
|
| 7 |
+
"Knowing Python is a plus.",
|
| 8 |
+
]
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def ner(text):
|
| 12 |
+
output = token_classifier(text)
|
| 13 |
+
return {"text": text, "entities": output}
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
demo = gr.Interface(ner,
|
| 17 |
+
gr.Textbox(placeholder="Enter sentence here..."),
|
| 18 |
+
gr.HighlightedText(),
|
| 19 |
+
examples=examples)
|
| 20 |
+
|
| 21 |
+
demo.launch()
|