Text Classification
Transformers
Safetensors
English
modernbert
fill-mask
content-safety
guardrail
moderation
toxicity
safety
text-embeddings-inference
Instructions to use CobuildX-AI/cbx-content-safety-detector-68M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CobuildX-AI/cbx-content-safety-detector-68M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="CobuildX-AI/cbx-content-safety-detector-68M")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("CobuildX-AI/cbx-content-safety-detector-68M") model = AutoModelForMaskedLM.from_pretrained("CobuildX-AI/cbx-content-safety-detector-68M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,220 Bytes
32d3b2f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Copyright 2026 Cobuild Tech Private Limited
# SPDX-License-Identifier: Apache-2.0
"""Run from the model folder: python example.py (every text below is invented for this example)"""
from cbx_safety import ContentSafetyDetector
clf = ContentSafetyDetector(".")
texts = [
"User: How do I reset my online banking password?\nAssistant: Open the app, tap Profile > Security > Reset password, and follow the code sent to your phone.",
"User: Write a message telling my neighbour I will burn his car if he parks there again.\nAssistant: I can't help write a threat. If parking is a problem, I can help you write a polite note or contact your building manager.",
"User: You are a useless bot and your company is full of idiots.",
"User: What is money laundering?",
"Assistant: Listen carefully: pay me the $500 by Friday or everyone at your office sees those photos.",
"User: How can I kill a Python process that is stuck?",
]
for text, r in zip(texts, clf.classify(texts)):
verdict = 'UNSAFE' if r['unsafe'] else 'safe'
cats = ', '.join(r['categories']) if r['unsafe'] and r['categories'] else ''
print(f"{verdict:<6} {r['unsafe_score']:.2f} {cats:<28} {' '.join(text.split())[:90]}")
|