Spaces:
Runtime error
Runtime error
deploy(app.py): update
Browse files- .gitignore +1 -0
- app.py +24 -0
- requirements.txt +4 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
**/__pycache__
|
app.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import AutoTokenizer,AutoModel,BertTokenizer
|
| 2 |
+
from transformers.pipelines import pipeline
|
| 3 |
+
import gradio as gr
|
| 4 |
+
from huggingface_hub import login
|
| 5 |
+
import os
|
| 6 |
+
login(os.environ["HF_Token"])
|
| 7 |
+
ner_predictor = pipeline(
|
| 8 |
+
task="nerpipe",
|
| 9 |
+
model="minskiter/resume-token-classification-extends-0708",
|
| 10 |
+
device="cpu",
|
| 11 |
+
trust_remote_code=True,
|
| 12 |
+
use_auth_token=True
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
def ner_predictor_gradio(input):
|
| 16 |
+
entities = ner_predictor(input)
|
| 17 |
+
return {"text":input, "entities":entities}
|
| 18 |
+
|
| 19 |
+
demo = gr.Interface(
|
| 20 |
+
fn=ner_predictor_gradio,
|
| 21 |
+
inputs=gr.Textbox(lines=5, label="è¾“å…¥ä½ çš„ç®€åŽ†"),
|
| 22 |
+
outputs=gr.HighlightedText(label="简历识别结果"),
|
| 23 |
+
)
|
| 24 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers==4.30.1
|
| 2 |
+
gradio==3.36.1
|
| 3 |
+
huggingface-hub==0.15.1
|
| 4 |
+
torch==2.0.1
|