Instructions to use AdamCodd/vit-base-nsfw-detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use AdamCodd/vit-base-nsfw-detector with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-classification', 'AdamCodd/vit-base-nsfw-detector'); - Transformers
How to use AdamCodd/vit-base-nsfw-detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="AdamCodd/vit-base-nsfw-detector") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("AdamCodd/vit-base-nsfw-detector") model = AutoModelForImageClassification.from_pretrained("AdamCodd/vit-base-nsfw-detector") - Notebooks
- Google Colab
- Kaggle
What was the training / eval dataset?
#2
by wendlerc - opened
Was the training/eval dataset something like this: https://huggingface.co/datasets/AdamCodd/Civitai-8m-prompts ?
No, this one was trained on a (small) personal dataset collected on internet and doesn't include any generated images.
@AdamCodd Thanks for your work and sharing. Can you please share what's the cutoff boundary that is used for the classification here ?
Hello @abhishek072 ,
The cutoff boundary used for classification is 0.5. Any image with a predicted NSFW probability greater than 0.5 is classified as NSFW, while others are classified as SFW.