Downloads · 30 days
13
15% of all-time downloads
alunadiderot/distilbert-base-uncased-adult-article-classifier-v1
distilbert-base-uncased-adult-article-classifier-v1 is a text classification model from alunadiderot. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
A DistilBERT-based classifier for NSFW (Not Safe For Work) content detection in articles using domain, title, and description fields.
Downloads · 30 days
13
15% of all-time downloads
All-time downloads
87
Public
Parameters
67M
801 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 50%
From the Hugging Face model README
A DistilBERT-based classifier for NSFW (Not Safe For Work) content detection in articles using domain, title, and description fields.
FALSE (Not NSFW), TRUE (NSFW)This model uses a custom architecture that:
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="your-username/distilbert-nsfw-classifier",
tokenizer="your-username/distilbert-nsfw-classifier"
)
# Prepare input text (combine domain, title, description)
text = """domain: example.com
title: Article Title Here
description: Article description text goes here"""
result = classifier(text)
print(result)
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "your-username/distilbert-nsfw-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Prepare input text
text = """domain: example.com
title: Article Title Here
description: Article description text goes here"""
# Tokenize
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
padding=True,
max_length=512
)
# Predict
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class_id = predictions.argmax().item()
confidence = predictions[0][predicted_class_id].item()
# Get label
id2label = model.config.id2label
predicted_label = id2label[predicted_class_id]
print(f"Predicted: {predicted_label} (confidence: {confidence:.4f})")
The model expects input text in a structured format with three fields:
domain: example.com
title: Article Title Here
description: Article description text goes here
Important:
field_name: valueTest Accuracy: 1.0000
Test Loss: 0.0016
Classification Report:
precision recall f1-score support
FALSE 1.00 1.00 1.00 120
TRUE 1.00 1.00 1.00 133
accuracy 1.00 253
This model is intended for:
Not intended for:
@misc{distilbert-nsfw-classifier,
title={DistilBERT NSFW Article Classifier},
author={Your Name},
year={2024},
howpublished={\url{https://huggingface.co/your-username/distilbert-nsfw-classifier}}
}
Apache 2.0