Downloads · 30 days
12
1% of all-time downloads
zguo0525/myshell_nsfw_filter
myshell_nsfw_filter is a image classification model from zguo0525. Use it when you need a label for an image. It is set up for transformers.
Here's a step-by-step Python code example to classify an image:
Downloads · 30 days
12
1% of all-time downloads
All-time downloads
1.2K
Public
Repo size
686 MB
Likes
0
Public
Click a slice to open those files.
.bin343 MB · 100%
From the Hugging Face model README
Here's a step-by-step Python code example to classify an image:
from transformers import pipeline
import requests
from PIL import Image
from io import BytesIO
# 1. Load the pipeline for image classification
pipe = pipeline("image-classification", model="zguo0525/myshell_nsfw_filter")
# 2. Load the image into memory (assuming you have the URL for the image)
image_url = 'https://img-myshell.net/meinamix/red_hair_girl'
response = requests.get(image_url)
image = Image.open(BytesIO(response.content))
# 3. Use the pipeline to classify the image
results = pipe(image)
# 4. Print the results
label = results[0]['label']
score = results[0]['score']
print(f"{label}: {score:.4f}")