How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-classification", model="davidmasip/racism")
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("davidmasip/racism")
model = AutoModelForSequenceClassification.from_pretrained("davidmasip/racism")
Quick Links

Model to predict whether a given text is racist or not:

  • LABEL_0 output indicates non-racist text
  • LABEL_1 output indicates racist text

Usage:

from transformers import pipeline

RACISM_MODEL = "davidmasip/racism"
racism_analysis_pipe = pipeline("text-classification",
                                model=RACISM_MODEL, tokenizer=RACISM_MODEL)

results = racism_analysis_pipe("Unos menas agreden a una mujer.")


def clean_labels(results):
    for result in results:
        label = "Non-racist" if results["label"] == "LABEL_0" else "Racist"
        result["label"] = label


clean_labels(results)
print(results)
Downloads last month
15
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for davidmasip/racism

Finetunes
4 models

Space using davidmasip/racism 1