File size: 675 Bytes
07eca22
9f86c43
 
 
 
 
 
07eca22
dab5952
07eca22
dab5952
 
9f86c43
 
 
dab5952
 
9f86c43
dab5952
 
 
 
 
9f86c43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from transformers import AutoTokenizer,AutoModel,BertTokenizer
from transformers.pipelines import pipeline
import gradio as gr
from huggingface_hub import login
import os
login(os.environ["HF_Token"])
ner_predictor = pipeline(
    task="nerpipe",
    model="minskiter/resume-token-classification",
    device="cpu",
    trust_remote_code=True,
    use_auth_token=True
)

def ner_predictor_gradio(input):
    entities = ner_predictor(input)
    return {"text":input, "entities":entities}

demo = gr.Interface(
    fn=ner_predictor_gradio, 
    inputs=gr.Textbox(lines=5, label="输入你的简历"), 
    outputs=gr.HighlightedText(label="简历识别结果"),
)
demo.launch()