Skip to main content
Do you like Artifex? Give it a ⭐ star on GitHub!

guardrail()

Perform inference with a Spam Detection model, on a single input string or a list of input strings. For each input string, this will return one of two predicted labels: spam or not_spam.

If no model is loaded, the base Spam Detection model tanaos/tanaos-spam-detection-v1 will be used by default. For more information on what the base Spam Detection model is trained to classify as spam or not_spam, 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 a value of either spam or not_spam, and a "score" key with a float value representing the model's confidence in its prediction

from artifex import Artifex

spam_detection = Artifex().spam_detection

print(spam_detection("You won an IPhone 16! Click here to claim your prize."))
[{'label': 'spam', 'score': 0.9989}]