Inference Providers documentation
Zero-Shot Classification
Zero-Shot Classification
Zero-shot text classification is super useful to try out classification with zero code, you simply pass a sentence/paragraph and the possible labels for that sentence, and you get a result. The model has not been necessarily trained on the labels you provide, but it can still predict the correct label.
For more details about the zero-shot-classification
task, check out its dedicated page! You will find examples and related materials.
Recommended models
Explore all available models and find the one that suits you best here.
Using the API
No snippet available for this task.
API specification
Request
Headers | ||
---|---|---|
authorization | string | Authentication header in the form 'Bearer: hf_****' when hf_**** is a personal user access token with “Inference Providers” permission. You can generate one from your settings page. |
Payload | ||
---|---|---|
inputs* | string | The text to classify |
parameters* | object | |
candidate_labels* | string[] | The set of possible class labels to classify the text into. |
hypothesis_template | string | The sentence used in conjunction with candidate_labels to attempt the text classification by replacing the placeholder with the candidate labels. |
multi_label | boolean | Whether multiple candidate labels can be true. If false, the scores are normalized such that the sum of the label likelihoods for each sequence is 1. If true, the labels are considered independent and probabilities are normalized for each candidate. |
Response
Body | ||
---|---|---|
(array) | object[] | Output is an array of objects. |
label | string | The predicted class label. |
score | number | The corresponding probability. |