emotion_detection()
Perform inference with an Emotion Detection model, on a single input string or a list of input strings. For each input string, this will return the predicted emotion label, which is one of the classes that the model was trained on.
If no model is loaded, the base Emotion Detection model tanaos/tanaos-emotion-detection-v1 will be used by default. For more information on what emotions the base Emotion Detection model is trained to recognize, see the model's Hugging Face page.
Arguments
- text str | list[str]
A string or a list of strings to classify. The model will return a label for each input string.
Response
A list[dict], each dict containing a "label" key with the predicted intent
label for the corresponding input string, and a "score" key with a float value
representing the model's confidence in its prediction.
- Python
from artifex import Artifex
emotion_detection = Artifex().emotion_detection
print(emotion_detection("I can't wait for the concert tonight!"))
- Response
[{'label': 'excitement', 'score': 0.9941}]