Image Classification
Transformers
Safetensors
English
vit
explicit-content-detection
mini
art
sensual-content-detection
Anime
prithivMLmods commited on
Commit
6ec6a8e
·
verified ·
1 Parent(s): 87b9bf7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +88 -0
README.md CHANGED
@@ -3,6 +3,12 @@ license: apache-2.0
3
  datasets:
4
  - strangerguardhf/NSFW-MultiDomain-Classification-v2.0
5
  ---
 
 
 
 
 
 
6
 
7
  ```py
8
  Classification Report:
@@ -20,3 +26,85 @@ Extincing & Sensual 0.9245 0.9717 0.9475 5618
20
  ```
21
 
22
  ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/VaSWP4-JjXrczImMGufQE.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  datasets:
4
  - strangerguardhf/NSFW-MultiDomain-Classification-v2.0
5
  ---
6
+ # **vit-mini-explicit-content**
7
+
8
+ > **vit-mini-explicit-content** is an image classification vision-language model fine-tuned from **vit-base-patch16-224-in21k** for a single-label classification task. It categorizes images based on their explicitness using the **ViTForImageClassification** architecture.
9
+
10
+ > \[!Note]
11
+ > This model is designed to promote safe, respectful, and responsible online spaces. It does **not** generate explicit content; it only classifies images. Misuse may violate platform or regional policies and is strongly discouraged.
12
 
13
  ```py
14
  Classification Report:
 
26
  ```
27
 
28
  ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/VaSWP4-JjXrczImMGufQE.png)
29
+
30
+ ---
31
+
32
+ The model categorizes images into five classes:
33
+
34
+ * **Class 0:** Anime Picture
35
+ * **Class 1:** Enticing & Sensual
36
+ * **Class 2:** Hentai
37
+ * **Class 3:** Pornography
38
+ * **Class 4:** Safe for Work
39
+
40
+ # **Run with Transformers 🤗**
41
+
42
+ ```python
43
+ !pip install -q transformers torch pillow gradio
44
+ ```
45
+
46
+ ```python
47
+ import gradio as gr
48
+ from transformers import ViTImageProcessor, ViTForImageClassification
49
+ from PIL import Image
50
+ import torch
51
+
52
+ # Load model and processor
53
+ model_name = "prithivMLmods/vit-mini-explicit-content" # Updated model path
54
+ model = ViTForImageClassification.from_pretrained(model_name)
55
+ processor = ViTImageProcessor.from_pretrained(model_name)
56
+
57
+ # Updated label mapping
58
+ labels = {
59
+ "0": "Anime Picture",
60
+ "1": "Enticing & Sensual",
61
+ "2": "Hentai",
62
+ "3": "Pornography",
63
+ "4": "Safe for Work"
64
+ }
65
+
66
+ def explicit_content_detection(image):
67
+ """Predicts the type of content in the image."""
68
+ image = Image.fromarray(image).convert("RGB")
69
+ inputs = processor(images=image, return_tensors="pt")
70
+
71
+ with torch.no_grad():
72
+ outputs = model(**inputs)
73
+ logits = outputs.logits
74
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
75
+
76
+ predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
77
+
78
+ return predictions
79
+
80
+ # Create Gradio interface
81
+ iface = gr.Interface(
82
+ fn=explicit_content_detection,
83
+ inputs=gr.Image(type="numpy"),
84
+ outputs=gr.Label(label="Prediction Scores"),
85
+ title="vit-mini-explicit-content",
86
+ description="Upload an image to classify whether it is anime, enticing & sensual, hentai, pornographic, or safe for work."
87
+ )
88
+
89
+ # Launch the app
90
+ if __name__ == "__main__":
91
+ iface.launch()
92
+ ```
93
+
94
+ ---
95
+
96
+ # **Recommended Use Cases**
97
+
98
+ * Image moderation pipelines
99
+ * Parental and institutional content filters
100
+ * Dataset cleansing before training
101
+ * Online safety and well-being platforms
102
+ * Enhancing search engine filtering
103
+
104
+ # **Discouraged / Prohibited Use**
105
+
106
+ * Non-consensual or malicious monitoring
107
+ * Automated judgments without human review
108
+ * Misrepresentation of moderation systems
109
+ * Use in unlawful or unethical surveillance
110
+ * Harassment, exploitation, or shaming