Update README.md
Browse files
README.md
CHANGED
|
@@ -14,6 +14,12 @@ tags:
|
|
| 14 |
- explicit-content-detection
|
| 15 |
- media-filter
|
| 16 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
```py
|
| 19 |
Classification Report:
|
|
@@ -31,3 +37,104 @@ Extincing & Sensual 0.8984 0.9477 0.9224 5618
|
|
| 31 |
```
|
| 32 |
|
| 33 |

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
- explicit-content-detection
|
| 15 |
- media-filter
|
| 16 |
---
|
| 17 |
+
# **siglip2-mini-explicit-content**
|
| 18 |
+
|
| 19 |
+
> **siglip2-mini-explicit-content** is an image classification vision-language encoder model fine-tuned from **`siglip2-base-patch16-512`** for a single-label classification task. It is designed to classify images into categories related to explicit, sensual, or safe-for-work content using the **SiglipForImageClassification** architecture.
|
| 20 |
+
|
| 21 |
+
> \[!Note]
|
| 22 |
+
> This model is intended to promote positive, safe, and respectful digital environments. Misuse is strongly discouraged and may violate platform or regional guidelines. As a classification model, it does not generate unsafe content and is suitable for moderation purposes.
|
| 23 |
|
| 24 |
```py
|
| 25 |
Classification Report:
|
|
|
|
| 37 |
```
|
| 38 |
|
| 39 |

|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
The model categorizes images into five classes:
|
| 44 |
+
|
| 45 |
+
* **Class 0:** Anime Picture
|
| 46 |
+
* **Class 1:** Extincing & Sensual
|
| 47 |
+
* **Class 2:** Hentai
|
| 48 |
+
* **Class 3:** Pornography
|
| 49 |
+
* **Class 4:** Safe for Work
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
# **Run with Transformers 🤗**
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
!pip install -q transformers torch pillow gradio
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
import gradio as gr
|
| 61 |
+
from transformers import AutoImageProcessor, SiglipForImageClassification
|
| 62 |
+
from transformers.image_utils import load_image
|
| 63 |
+
from PIL import Image
|
| 64 |
+
import torch
|
| 65 |
+
|
| 66 |
+
# Load model and processor
|
| 67 |
+
model_name = "prithivMLmods/siglip2-mini-explicit-content"
|
| 68 |
+
model = SiglipForImageClassification.from_pretrained(model_name)
|
| 69 |
+
processor = AutoImageProcessor.from_pretrained(model_name)
|
| 70 |
+
|
| 71 |
+
# Updated labels
|
| 72 |
+
labels = {
|
| 73 |
+
"0": "Anime Picture",
|
| 74 |
+
"1": "Extincing & Sensual",
|
| 75 |
+
"2": "Hentai",
|
| 76 |
+
"3": "Pornography",
|
| 77 |
+
"4": "Safe for Work"
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
def detect_explicit_content(image):
|
| 81 |
+
"""Predicts content category in an uploaded image."""
|
| 82 |
+
image = Image.fromarray(image).convert("RGB")
|
| 83 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 84 |
+
|
| 85 |
+
with torch.no_grad():
|
| 86 |
+
outputs = model(**inputs)
|
| 87 |
+
logits = outputs.logits
|
| 88 |
+
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
|
| 89 |
+
|
| 90 |
+
predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
|
| 91 |
+
return predictions
|
| 92 |
+
|
| 93 |
+
# Gradio Interface
|
| 94 |
+
iface = gr.Interface(
|
| 95 |
+
fn=detect_explicit_content,
|
| 96 |
+
inputs=gr.Image(type="numpy"),
|
| 97 |
+
outputs=gr.Label(label="Prediction Scores"),
|
| 98 |
+
title="siglip2-mini-explicit-content",
|
| 99 |
+
description="Upload an image to classify it as Anime, Hentai, Sensual, Pornographic, or Safe for Work."
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
if __name__ == "__main__":
|
| 103 |
+
iface.launch()
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
---
|
| 107 |
+
|
| 108 |
+
# **Guidelines for Use of siglip2-mini-explicit-content**
|
| 109 |
+
|
| 110 |
+
This model is designed for responsible content moderation and filtering. It is especially tuned for anime, hentai, and adult content. Use it ethically, with the following guidelines:
|
| 111 |
+
|
| 112 |
+
### **Recommended Use Cases**
|
| 113 |
+
|
| 114 |
+
* Content Moderation in social media and forums
|
| 115 |
+
* Parental Controls for safer browsing environments
|
| 116 |
+
* Dataset Curation for removing NSFW images from training data
|
| 117 |
+
* Safe Search Filtering for engines and discovery systems
|
| 118 |
+
* Workplace Image Scanning for compliance
|
| 119 |
+
|
| 120 |
+
### **Prohibited or Discouraged Use**
|
| 121 |
+
|
| 122 |
+
* Harassment, exposure, or targeting of individuals
|
| 123 |
+
* Use on private content without consent
|
| 124 |
+
* Illegal or unethical surveillance
|
| 125 |
+
* Sole reliance for legal or reputational decisions
|
| 126 |
+
* Deceptive manipulation of moderation results
|
| 127 |
+
|
| 128 |
+
---
|
| 129 |
+
|
| 130 |
+
# **Important Notes**
|
| 131 |
+
|
| 132 |
+
* Optimized for **anime and adult content detection**. Not suitable for detecting violence, drugs, or hate symbols.
|
| 133 |
+
* Probabilistic outputs — always **verify** with human review where needed.
|
| 134 |
+
* This model's predictions are **not legal classifications**.
|
| 135 |
+
|
| 136 |
+
---
|
| 137 |
+
|
| 138 |
+
## **Ethical Reminder**
|
| 139 |
+
|
| 140 |
+
This tool was created to **enhance digital safety**. Do not use it to harm, surveil, or exploit individuals or communities. By using this model, you commit to ethical and privacy-respecting practices.
|