mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-30 11:00:11 +08:00
add pipeline support for token classification
This commit is contained in:
parent
1a4302ce88
commit
7979ce1a85
@ -203,6 +203,13 @@ def get_huggingface_interface(model_name, api_key, alias):
|
||||
"preprocess": lambda x: {"inputs": x},
|
||||
"postprocess": encode_to_base64,
|
||||
},
|
||||
"token-classification": {
|
||||
# example model: hf.co/huggingface-course/bert-finetuned-ner
|
||||
"inputs": inputs.Textbox(label="Input"),
|
||||
"outputs": outputs.HighlightedText(label="Output"),
|
||||
"preprocess": lambda x: {"inputs": x},
|
||||
"postprocess": lambda r: [(i["word"], i["entity_group"]) for i in r.json()],
|
||||
},
|
||||
}
|
||||
|
||||
if p is None or not (p in pipelines):
|
||||
|
Loading…
Reference in New Issue
Block a user