Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
text-generation-inference
VisionGuardrail
JSON
image-classification
content-safety
content-moderation
multimodal
safety-classifier
guardrail
visual-safety
multimodal-content-filter
mmcf
v1.0
conversational
Instructions to use prithivMLmods/VisionGuardrail-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/VisionGuardrail-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/VisionGuardrail-4B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("prithivMLmods/VisionGuardrail-4B") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/VisionGuardrail-4B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use prithivMLmods/VisionGuardrail-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/VisionGuardrail-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/VisionGuardrail-4B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/prithivMLmods/VisionGuardrail-4B
- SGLang
How to use prithivMLmods/VisionGuardrail-4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "prithivMLmods/VisionGuardrail-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/VisionGuardrail-4B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "prithivMLmods/VisionGuardrail-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/VisionGuardrail-4B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use prithivMLmods/VisionGuardrail-4B with Docker Model Runner:
docker model run hf.co/prithivMLmods/VisionGuardrail-4B
Update README.md
Browse files
README.md
CHANGED
|
@@ -3,19 +3,41 @@
|
|
| 3 |
|
| 4 |
.vg-container, .vg-container * {
|
| 5 |
font-family: 'Ubuntu', sans-serif;
|
|
|
|
| 6 |
}
|
| 7 |
|
| 8 |
.vg-code, .vg-code * {
|
| 9 |
font-family: 'Ubuntu Mono', 'Courier New', monospace !important;
|
| 10 |
-
line-height: 1.4 !important;
|
| 11 |
}
|
| 12 |
|
| 13 |
-
.vg-table
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
}
|
| 16 |
|
| 17 |
-
.vg-table
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
</style>
|
| 21 |
|
|
@@ -23,7 +45,7 @@
|
|
| 23 |
|
| 24 |
<h1 style="color: #FFFFFF; font-weight: 500; border-bottom: 1px solid #333333; padding-bottom: 8px; margin-top: 0;">VisionGuardrail-4B</h1>
|
| 25 |
|
| 26 |
-
<p style="color: #FFFFFF;">
|
| 27 |
<b>VisionGuardrail-4B</b> is a multimodal content-safety classifier based on <b>Qwen/Qwen3.5-4B</b> and trained on the <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" style="color: #FF4500; text-decoration: none;">prithivMLmods/ImageShield-Guardrail-Pro</a> content-safety guardrail dataset. The model is designed to classify visual content as <b>Safe</b> or <b>Unsafe</b>, with a particular focus on detecting <b>Not Safe for Work (NSFW) sensual content</b> and other potentially sensitive visual content. VisionGuardrail-4B excels at detecting <b>explicit and sensitive visual content</b>, with detailed analysis of <b>dress codes, clothing exposure, poses, framing, and different visual settings</b> to support conservative content-safety classification.
|
| 28 |
</p>
|
| 29 |
|
|
@@ -45,32 +67,25 @@
|
|
| 45 |
<div style="display: flex; align-items: flex-start; margin-bottom: 8px; color: #FFFFFF;"><span style="margin-right: 12px; color: #FFFFFF; font-weight: bold;">+</span><span><b>Zero-Tolerance Safety Classification</b>: Uses a conservative classification policy that favors safety when the content is ambiguous.</span></div>
|
| 46 |
<div style="display: flex; align-items: flex-start; margin-bottom: 8px; color: #FFFFFF;"><span style="margin-right: 12px; color: #FFFFFF; font-weight: bold;">+</span><span><b>Structured Output</b>: Produces a machine-readable JSON response containing a caption, classification, and reasoning.</span></div>
|
| 47 |
|
| 48 |
-
<details style="border: 1px solid #333333; border-radius: 4px; margin
|
| 49 |
<summary style="padding: 12px 16px; cursor: pointer; color: #FFFFFF !important; font-weight: 500; background-color: #111111; list-style: none; display: flex; justify-content: space-between; font-family: 'Ubuntu', sans-serif;">Standard Instruction</summary>
|
| 50 |
<div style="background-color: #000000; border: none; border-radius: 0; margin: 0; overflow: hidden;">
|
| 51 |
-
<div style="background-color: #1a1a1a; padding:
|
| 52 |
-
<button onclick="copyCode(this)" style="background-color: #333333; color: #FFFFFF; border: none; padding: 4px 10px; cursor: pointer; border-radius: 4px; font-size: 12px; font-family: 'Ubuntu', sans-serif;
|
| 53 |
</div>
|
| 54 |
-
<pre class="vg-code" style="margin: 0; padding: 16px; background-color: #000000 !important; color: #FFFFFF !important; overflow-x: auto; font-size: 14px;">You are a strict, zero-tolerance parental control content-safety guardrail classifier for visual media.
|
| 55 |
|
| 56 |
Your role is minor protection: any media containing suggestive, revealing, sexually provocative, or explicit visual elements must be flagged as NSFW.
|
| 57 |
|
| 58 |
STRICT ZERO-TOLERANCE CLASSIFICATION RULES:
|
| 59 |
|
| 60 |
1. Nudity & Exposure: Any full or partial nudity, exposed breasts, cleavage, buttocks, groin, or visible pubic area MUST be classified as NSFW.
|
| 61 |
-
|
| 62 |
2. Underwear & Swimwear: Thongs, G-strings, micro-bikinis, skimpy or revealing swimwear, bras, panties, lingerie, see-through clothing, or unbuttoned tops revealing undergarments or bare torsos MUST be classified as NSFW.
|
| 63 |
-
|
| 64 |
3. Dress-Code Analysis: Carefully analyze clothing, coverage, transparency, exposure, and the overall dress code. Revealing or sexually provocative clothing MUST be classified as NSFW.
|
| 65 |
-
|
| 66 |
4. Poses & Suggestiveness: Sexually suggestive poses, seductive modeling, cleavage-emphasizing framing, fetish content, or explicit erotic themes MUST be classified as NSFW.
|
| 67 |
-
|
| 68 |
5. Context & Setting: Consider the visual setting, composition, framing, and contextual cues when evaluating potentially sensitive content.
|
| 69 |
-
|
| 70 |
6. Artwork & Animation: Anime nudes, ecchi, hentai, suggestive illustrations, or 2D/3D stylized erotica MUST be classified as NSFW.
|
| 71 |
-
|
| 72 |
7. Sensitive Visual Content: Explicit or highly suggestive visual content MUST be classified as NSFW even when presented in non-photorealistic or artistic formats.
|
| 73 |
-
|
| 74 |
8. Classification Threshold: When in doubt, err on the side of caution and classify the content as NSFW.
|
| 75 |
|
| 76 |
Output strictly valid JSON with no extra conversational text, commentary, or markdown formatting outside the JSON object:
|
|
@@ -88,18 +103,18 @@ Output strictly valid JSON with no extra conversational text, commentary, or mar
|
|
| 88 |
<h2 style="color: #FFFFFF; font-weight: 500; border-bottom: 1px solid #333333; padding-bottom: 8px; margin-top: 32px;">Quick Start with Transformers</h2>
|
| 89 |
|
| 90 |
<div style="background-color: #000000; border: 1px solid #333333; border-radius: 4px; margin-bottom: 16px; overflow: hidden;">
|
| 91 |
-
<div style="background-color: #1a1a1a; padding:
|
| 92 |
-
<button onclick="copyCode(this)" style="background-color: #333333; color: #FFFFFF; border: none; padding: 4px 10px; cursor: pointer; border-radius: 4px; font-size: 12px; font-family: 'Ubuntu', sans-serif;
|
| 93 |
</div>
|
| 94 |
-
<pre class="vg-code" style="margin: 0; padding: 16px; background-color: #000000 !important; color: #FFFFFF !important; overflow-x: auto; font-size: 14px;">pip install transformers
|
| 95 |
pip install accelerate</pre>
|
| 96 |
</div>
|
| 97 |
|
| 98 |
<div style="background-color: #000000; border: 1px solid #333333; border-radius: 4px; margin-bottom: 16px; overflow: hidden;">
|
| 99 |
-
<div style="background-color: #1a1a1a; padding:
|
| 100 |
-
<button onclick="copyCode(this)" style="background-color: #333333; color: #FFFFFF; border: none; padding: 4px 10px; cursor: pointer; border-radius: 4px; font-size: 12px; font-family: 'Ubuntu', sans-serif;
|
| 101 |
</div>
|
| 102 |
-
<pre class="vg-code" style="margin: 0; padding: 16px; background-color: #000000 !important; color: #FFFFFF !important; overflow-x: auto; font-size: 14px;">from transformers import Qwen3_5ForConditionalGeneration, AutoProcessor
|
| 103 |
import torch
|
| 104 |
|
| 105 |
model = Qwen3_5ForConditionalGeneration.from_pretrained(
|
|
@@ -155,54 +170,46 @@ print(output_text[0])</pre>
|
|
| 155 |
|
| 156 |
<h2 style="color: #FFFFFF; font-weight: 500; border-bottom: 1px solid #333333; padding-bottom: 8px; margin-top: 32px;">Training Details</h2>
|
| 157 |
|
| 158 |
-
<
|
| 159 |
-
<
|
| 160 |
-
<
|
| 161 |
-
<
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
</
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
</
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
</
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
</
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
</
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
</
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
</
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
</tr>
|
| 199 |
-
<tr>
|
| 200 |
-
<td style="padding: 12px 16px; font-weight: 500;">Training Framework</td>
|
| 201 |
-
<td style="padding: 12px 16px;">TRL</td>
|
| 202 |
-
</tr>
|
| 203 |
-
</tbody>
|
| 204 |
-
</table>
|
| 205 |
-
</div>
|
| 206 |
|
| 207 |
<h2 style="color: #FFFFFF; font-weight: 500; border-bottom: 1px solid #333333; padding-bottom: 8px; margin-top: 32px;">Intended Use</h2>
|
| 208 |
<div style="display: flex; align-items: flex-start; margin-bottom: 8px; color: #FFFFFF;"><span style="margin-right: 12px; color: #FFFFFF; font-weight: bold;">+</span><span><b>Content Safety Classification</b>: Classifying visual media as safe or unsafe.</span></div>
|
|
@@ -233,16 +240,29 @@ print(output_text[0])</pre>
|
|
| 233 |
<script>
|
| 234 |
function copyCode(btn) {
|
| 235 |
const codeBlock = btn.parentElement.nextElementSibling;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
const textArea = document.createElement('textarea');
|
| 237 |
-
textArea.value =
|
|
|
|
|
|
|
| 238 |
document.body.appendChild(textArea);
|
|
|
|
| 239 |
textArea.select();
|
| 240 |
try {
|
| 241 |
document.execCommand('copy');
|
| 242 |
btn.innerText = 'Copied!';
|
| 243 |
-
setTimeout(() => {
|
| 244 |
-
btn.innerText = 'Copy';
|
| 245 |
-
}, 2000);
|
| 246 |
} catch (err) {
|
| 247 |
console.error('Failed to copy text: ', err);
|
| 248 |
}
|
|
|
|
| 3 |
|
| 4 |
.vg-container, .vg-container * {
|
| 5 |
font-family: 'Ubuntu', sans-serif;
|
| 6 |
+
box-sizing: border-box;
|
| 7 |
}
|
| 8 |
|
| 9 |
.vg-code, .vg-code * {
|
| 10 |
font-family: 'Ubuntu Mono', 'Courier New', monospace !important;
|
|
|
|
| 11 |
}
|
| 12 |
|
| 13 |
+
.vg-table {
|
| 14 |
+
width: 100%;
|
| 15 |
+
border-collapse: separate;
|
| 16 |
+
border-spacing: 0;
|
| 17 |
+
margin: 20px 0;
|
| 18 |
+
color: #FFFFFF;
|
| 19 |
+
border: 1px solid #333333;
|
| 20 |
+
border-radius: 6px;
|
| 21 |
+
overflow: hidden;
|
| 22 |
}
|
| 23 |
|
| 24 |
+
.vg-table tr:not(:last-child) td {
|
| 25 |
+
border-bottom: 1px solid #333333;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.vg-table td:first-child {
|
| 29 |
+
border-right: 1px solid #333333;
|
| 30 |
+
width: 32%;
|
| 31 |
+
background-color: #121212;
|
| 32 |
+
font-weight: 500;
|
| 33 |
+
color: #DDDDDD;
|
| 34 |
+
padding: 10px 16px;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.vg-table td:last-child {
|
| 38 |
+
background-color: #080808;
|
| 39 |
+
color: #FFFFFF;
|
| 40 |
+
padding: 10px 16px;
|
| 41 |
}
|
| 42 |
</style>
|
| 43 |
|
|
|
|
| 45 |
|
| 46 |
<h1 style="color: #FFFFFF; font-weight: 500; border-bottom: 1px solid #333333; padding-bottom: 8px; margin-top: 0;">VisionGuardrail-4B</h1>
|
| 47 |
|
| 48 |
+
<p style="color: #FFFFFF; margin: 16px 0;">
|
| 49 |
<b>VisionGuardrail-4B</b> is a multimodal content-safety classifier based on <b>Qwen/Qwen3.5-4B</b> and trained on the <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" style="color: #FF4500; text-decoration: none;">prithivMLmods/ImageShield-Guardrail-Pro</a> content-safety guardrail dataset. The model is designed to classify visual content as <b>Safe</b> or <b>Unsafe</b>, with a particular focus on detecting <b>Not Safe for Work (NSFW) sensual content</b> and other potentially sensitive visual content. VisionGuardrail-4B excels at detecting <b>explicit and sensitive visual content</b>, with detailed analysis of <b>dress codes, clothing exposure, poses, framing, and different visual settings</b> to support conservative content-safety classification.
|
| 50 |
</p>
|
| 51 |
|
|
|
|
| 67 |
<div style="display: flex; align-items: flex-start; margin-bottom: 8px; color: #FFFFFF;"><span style="margin-right: 12px; color: #FFFFFF; font-weight: bold;">+</span><span><b>Zero-Tolerance Safety Classification</b>: Uses a conservative classification policy that favors safety when the content is ambiguous.</span></div>
|
| 68 |
<div style="display: flex; align-items: flex-start; margin-bottom: 8px; color: #FFFFFF;"><span style="margin-right: 12px; color: #FFFFFF; font-weight: bold;">+</span><span><b>Structured Output</b>: Produces a machine-readable JSON response containing a caption, classification, and reasoning.</span></div>
|
| 69 |
|
| 70 |
+
<details style="border: 1px solid #333333; border-radius: 4px; margin: 24px 0 16px 0; overflow: hidden; background-color: #000000;">
|
| 71 |
<summary style="padding: 12px 16px; cursor: pointer; color: #FFFFFF !important; font-weight: 500; background-color: #111111; list-style: none; display: flex; justify-content: space-between; font-family: 'Ubuntu', sans-serif;">Standard Instruction</summary>
|
| 72 |
<div style="background-color: #000000; border: none; border-radius: 0; margin: 0; overflow: hidden;">
|
| 73 |
+
<div style="background-color: #1a1a1a; padding: 8px 16px; border-bottom: 1px solid #333333; display: flex; justify-content: flex-end; align-items: center;">
|
| 74 |
+
<button onclick="copyCode(this)" style="background-color: #333333; color: #FFFFFF; border: none; padding: 4px 10px; cursor: pointer; border-radius: 4px; font-size: 12px; font-family: 'Ubuntu', sans-serif;">Copy</button>
|
| 75 |
</div>
|
| 76 |
+
<pre class="vg-code" style="margin: 0; padding: 16px; background-color: #000000 !important; color: #FFFFFF !important; overflow-x: auto; font-family: 'Ubuntu Mono', 'Courier New', monospace !important; font-size: 14px; white-space: pre-wrap; line-height: 1.45;">You are a strict, zero-tolerance parental control content-safety guardrail classifier for visual media.
|
| 77 |
|
| 78 |
Your role is minor protection: any media containing suggestive, revealing, sexually provocative, or explicit visual elements must be flagged as NSFW.
|
| 79 |
|
| 80 |
STRICT ZERO-TOLERANCE CLASSIFICATION RULES:
|
| 81 |
|
| 82 |
1. Nudity & Exposure: Any full or partial nudity, exposed breasts, cleavage, buttocks, groin, or visible pubic area MUST be classified as NSFW.
|
|
|
|
| 83 |
2. Underwear & Swimwear: Thongs, G-strings, micro-bikinis, skimpy or revealing swimwear, bras, panties, lingerie, see-through clothing, or unbuttoned tops revealing undergarments or bare torsos MUST be classified as NSFW.
|
|
|
|
| 84 |
3. Dress-Code Analysis: Carefully analyze clothing, coverage, transparency, exposure, and the overall dress code. Revealing or sexually provocative clothing MUST be classified as NSFW.
|
|
|
|
| 85 |
4. Poses & Suggestiveness: Sexually suggestive poses, seductive modeling, cleavage-emphasizing framing, fetish content, or explicit erotic themes MUST be classified as NSFW.
|
|
|
|
| 86 |
5. Context & Setting: Consider the visual setting, composition, framing, and contextual cues when evaluating potentially sensitive content.
|
|
|
|
| 87 |
6. Artwork & Animation: Anime nudes, ecchi, hentai, suggestive illustrations, or 2D/3D stylized erotica MUST be classified as NSFW.
|
|
|
|
| 88 |
7. Sensitive Visual Content: Explicit or highly suggestive visual content MUST be classified as NSFW even when presented in non-photorealistic or artistic formats.
|
|
|
|
| 89 |
8. Classification Threshold: When in doubt, err on the side of caution and classify the content as NSFW.
|
| 90 |
|
| 91 |
Output strictly valid JSON with no extra conversational text, commentary, or markdown formatting outside the JSON object:
|
|
|
|
| 103 |
<h2 style="color: #FFFFFF; font-weight: 500; border-bottom: 1px solid #333333; padding-bottom: 8px; margin-top: 32px;">Quick Start with Transformers</h2>
|
| 104 |
|
| 105 |
<div style="background-color: #000000; border: 1px solid #333333; border-radius: 4px; margin-bottom: 16px; overflow: hidden;">
|
| 106 |
+
<div style="background-color: #1a1a1a; padding: 8px 16px; border-bottom: 1px solid #333333; display: flex; justify-content: flex-end; align-items: center;">
|
| 107 |
+
<button onclick="copyCode(this)" style="background-color: #333333; color: #FFFFFF; border: none; padding: 4px 10px; cursor: pointer; border-radius: 4px; font-size: 12px; font-family: 'Ubuntu', sans-serif;">Copy</button>
|
| 108 |
</div>
|
| 109 |
+
<pre class="vg-code" style="margin: 0; padding: 16px; background-color: #000000 !important; color: #FFFFFF !important; overflow-x: auto; font-family: 'Ubuntu Mono', 'Courier New', monospace !important; font-size: 14px; white-space: pre-wrap; line-height: 1.45;">pip install transformers
|
| 110 |
pip install accelerate</pre>
|
| 111 |
</div>
|
| 112 |
|
| 113 |
<div style="background-color: #000000; border: 1px solid #333333; border-radius: 4px; margin-bottom: 16px; overflow: hidden;">
|
| 114 |
+
<div style="background-color: #1a1a1a; padding: 8px 16px; border-bottom: 1px solid #333333; display: flex; justify-content: flex-end; align-items: center;">
|
| 115 |
+
<button onclick="copyCode(this)" style="background-color: #333333; color: #FFFFFF; border: none; padding: 4px 10px; cursor: pointer; border-radius: 4px; font-size: 12px; font-family: 'Ubuntu', sans-serif;">Copy</button>
|
| 116 |
</div>
|
| 117 |
+
<pre class="vg-code" style="margin: 0; padding: 16px; background-color: #000000 !important; color: #FFFFFF !important; overflow-x: auto; font-family: 'Ubuntu Mono', 'Courier New', monospace !important; font-size: 14px; white-space: pre-wrap; line-height: 1.45;">from transformers import Qwen3_5ForConditionalGeneration, AutoProcessor
|
| 118 |
import torch
|
| 119 |
|
| 120 |
model = Qwen3_5ForConditionalGeneration.from_pretrained(
|
|
|
|
| 170 |
|
| 171 |
<h2 style="color: #FFFFFF; font-weight: 500; border-bottom: 1px solid #333333; padding-bottom: 8px; margin-top: 32px;">Training Details</h2>
|
| 172 |
|
| 173 |
+
<table class="vg-table">
|
| 174 |
+
<tbody>
|
| 175 |
+
<tr>
|
| 176 |
+
<td>Base Model</td>
|
| 177 |
+
<td>Qwen/Qwen3.5-4B</td>
|
| 178 |
+
</tr>
|
| 179 |
+
<tr>
|
| 180 |
+
<td>Model</td>
|
| 181 |
+
<td>VisionGuardrail-4B</td>
|
| 182 |
+
</tr>
|
| 183 |
+
<tr>
|
| 184 |
+
<td>Model Type</td>
|
| 185 |
+
<td>Multimodal Content-Safety Classifier</td>
|
| 186 |
+
</tr>
|
| 187 |
+
<tr>
|
| 188 |
+
<td>Training Dataset</td>
|
| 189 |
+
<td>prithivMLmods/ImageShield-Guardrail-Pro</td>
|
| 190 |
+
</tr>
|
| 191 |
+
<tr>
|
| 192 |
+
<td>Training Objective</td>
|
| 193 |
+
<td>Content-safety guardrail classification</td>
|
| 194 |
+
</tr>
|
| 195 |
+
<tr>
|
| 196 |
+
<td>Primary Classification</td>
|
| 197 |
+
<td>Safe / Unsafe</td>
|
| 198 |
+
</tr>
|
| 199 |
+
<tr>
|
| 200 |
+
<td>Safety Focus</td>
|
| 201 |
+
<td>Not Safe for Work (NSFW) Sensual Content</td>
|
| 202 |
+
</tr>
|
| 203 |
+
<tr>
|
| 204 |
+
<td>Visual Analysis</td>
|
| 205 |
+
<td>Dress Codes, Poses, Exposure & Settings</td>
|
| 206 |
+
</tr>
|
| 207 |
+
<tr>
|
| 208 |
+
<td>Training Framework</td>
|
| 209 |
+
<td>TRL</td>
|
| 210 |
+
</tr>
|
| 211 |
+
</tbody>
|
| 212 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
<h2 style="color: #FFFFFF; font-weight: 500; border-bottom: 1px solid #333333; padding-bottom: 8px; margin-top: 32px;">Intended Use</h2>
|
| 215 |
<div style="display: flex; align-items: flex-start; margin-bottom: 8px; color: #FFFFFF;"><span style="margin-right: 12px; color: #FFFFFF; font-weight: bold;">+</span><span><b>Content Safety Classification</b>: Classifying visual media as safe or unsafe.</span></div>
|
|
|
|
| 240 |
<script>
|
| 241 |
function copyCode(btn) {
|
| 242 |
const codeBlock = btn.parentElement.nextElementSibling;
|
| 243 |
+
const textToCopy = codeBlock.innerText.trim();
|
| 244 |
+
if (navigator.clipboard && window.isSecureContext) {
|
| 245 |
+
navigator.clipboard.writeText(textToCopy).then(() => {
|
| 246 |
+
btn.innerText = 'Copied!';
|
| 247 |
+
setTimeout(() => { btn.innerText = 'Copy'; }, 2000);
|
| 248 |
+
}).catch(() => fallbackCopy(textToCopy, btn));
|
| 249 |
+
} else {
|
| 250 |
+
fallbackCopy(textToCopy, btn);
|
| 251 |
+
}
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
function fallbackCopy(text, btn) {
|
| 255 |
const textArea = document.createElement('textarea');
|
| 256 |
+
textArea.value = text;
|
| 257 |
+
textArea.style.position = 'fixed';
|
| 258 |
+
textArea.style.opacity = '0';
|
| 259 |
document.body.appendChild(textArea);
|
| 260 |
+
textArea.focus();
|
| 261 |
textArea.select();
|
| 262 |
try {
|
| 263 |
document.execCommand('copy');
|
| 264 |
btn.innerText = 'Copied!';
|
| 265 |
+
setTimeout(() => { btn.innerText = 'Copy'; }, 2000);
|
|
|
|
|
|
|
| 266 |
} catch (err) {
|
| 267 |
console.error('Failed to copy text: ', err);
|
| 268 |
}
|