add pipeline support for token classification

This commit is contained in:
dawoodkhan82 2022-03-21 06:13:02 -04:00
parent 1a4302ce88
commit 7979ce1a85

View File

@ -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):