NSFW Content Classifier
Model Description
This model is a fine-tuned text classification model for detecting NSFW (Not Safe For Work) content in text messages. It is based on a transformer architecture and has been trained to distinguish between explicit sexual content (NSFW) and safe content (SFW).
Developed by: MyPlaygirl AI Team
Model type: Text Classification
Language: English
License: MIT
Labels
- 0: NSFW (Not Safe For Work)
- 1: SFW (Safe For Work)
Performance Metrics
Evaluated on 100 test samples with 90% confidence threshold:
Overall Performance
- Accuracy: 1.0000
- Average Confidence: 0.9924
- High Confidence Predictions (≥90%): 98/100 (98.0%)
- High Confidence Accuracy: 1.0000
Detailed Metrics
| Metric | NSFW Class (0) | Macro Average |
|---|---|---|
| Precision | 1.0000 | 1.0000 |
| Recall | 1.0000 | 1.0000 |
| F1 Score | 1.0000 | 1.0000 |
Confusion Matrix
Predicted
NSFW SFW
Actual NSFW 50 0
SFW 0 50
Usage
Basic Usage with Confidence Scores
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import torch.nn.functional as F
# Load model
model_name = "surya120/myplaygirl-nsfw-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Prepare text
text = "Your text here"
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=512)
# Predict with confidence scores
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
# Get probabilities
probs = F.softmax(logits, dim=-1)
confidence, prediction = torch.max(probs, dim=-1)
prediction = prediction.item()
confidence = confidence.item()
# Interpret result
label = "NSFW" if prediction == 0 else "SFW"
print(f"Prediction: {label}")
print(f"Confidence: {confidence:.2%}")
# Apply confidence threshold (recommended: 90%)
CONFIDENCE_THRESHOLD = 0.90
if confidence >= CONFIDENCE_THRESHOLD:
print(f"High confidence prediction: {label}")
else:
print(f"Low confidence prediction: {label} (consider manual review)")
Training Data
The model was trained on a custom curated dataset containing:
- Training samples: Text messages with explicit sexual content (NSFW) and safe conversational content (SFW)
- Labels: Binary classification (0 = NSFW, 1 = SFW)
- Data source: Custom generated dataset focused on conversational text moderation
Training Details
- Base model: Transformer-based sequence classification model
- Fine-tuning: Supervised learning on labeled NSFW/SFW text data
- Objective: Binary text classification for content moderation
Testing & Evaluation
The model was evaluated on 100 balanced test samples (50 NSFW, 50 SFW):
Test Results Summary
- ✅ Perfect classification: All samples correctly classified
- ✅ High confidence: 98/100 predictions above 90% confidence
- ✅ Zero false positives and false negatives
Confidence Threshold Analysis
- Recommended threshold: 90%
- Average confidence: 99.24%
- High confidence accuracy: 100.00%
For predictions below the confidence threshold, manual review is recommended for production use.
Limitations
- The model is trained specifically on text-based content
- Performance may vary on content types not well-represented in the training data
- Should be used as part of a comprehensive content moderation system
Ethical Considerations
This model is designed for content moderation purposes. Users should:
- Be aware of potential biases in classification
- Use the model responsibly and in compliance with applicable laws
- Consider the context and implement appropriate human review processes