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');
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")