Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
text-generation-inference
JSON
image-classification
content-safety
content-moderation
multimodal
safety-classifier
guardrail
ncii-detection
visual-safety
qwen3.5
multimodal-content-filter
conversational
Instructions to use prithivMLmods/ImageShield-MMCF-0.8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/ImageShield-MMCF-0.8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/ImageShield-MMCF-0.8B") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("prithivMLmods/ImageShield-MMCF-0.8B") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/ImageShield-MMCF-0.8B", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use prithivMLmods/ImageShield-MMCF-0.8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/ImageShield-MMCF-0.8B" # 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/ImageShield-MMCF-0.8B", "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/ImageShield-MMCF-0.8B
- SGLang
How to use prithivMLmods/ImageShield-MMCF-0.8B 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/ImageShield-MMCF-0.8B" \ --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/ImageShield-MMCF-0.8B", "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/ImageShield-MMCF-0.8B" \ --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/ImageShield-MMCF-0.8B", "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/ImageShield-MMCF-0.8B with Docker Model Runner:
docker model run hf.co/prithivMLmods/ImageShield-MMCF-0.8B
Update README.md
Browse files
README.md
CHANGED
|
@@ -135,6 +135,70 @@ output_text = processor.batch_decode(
|
|
| 135 |
print(output_text[0])
|
| 136 |
```
|
| 137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
## **Training Details**
|
| 139 |
|
| 140 |
| Setting | Value |
|
|
|
|
| 135 |
print(output_text[0])
|
| 136 |
```
|
| 137 |
|
| 138 |
+
---
|
| 139 |
+
|
| 140 |
+
## **Example Cards**
|
| 141 |
+
|
| 142 |
+
<div style="background-color: #000000; font-family: 'Courier New', Courier, monospace; color: #FFFFFF; padding: 24px; border-radius: 12px; border: 1px solid #333333; max-width: 800px; margin: 0 auto;">
|
| 143 |
+
|
| 144 |
+
<!-- Thin Line Bar (Top Separator) -->
|
| 145 |
+
<hr style="border: 0; border-top: 1px solid #333333; margin: 0 0 32px 0;">
|
| 146 |
+
|
| 147 |
+
<!-- Card 1 -->
|
| 148 |
+
<div style="margin-bottom: 32px;">
|
| 149 |
+
<div style="border-radius: 8px; overflow: hidden; margin-bottom: 16px; border: 1px solid #222;">
|
| 150 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/yypVvKdEH3W5qcmt4E36R.jpeg" alt="Safe Image 1" style="width: 100%; height: auto; display: block;">
|
| 151 |
+
</div>
|
| 152 |
+
<pre style="background-color: #0a0a0a; padding: 16px; border-radius: 8px; border: 1px solid #222; color: #e0e0e0; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; margin: 0;">
|
| 153 |
+
{
|
| 154 |
+
"caption": "A woman in a white tank top stands outdoors, gesturing with her right hand near her face while speaking. She wears a silver necklace and a bracelet. To her right, a man in a dark shirt is partially visible, looking towards her. The background shows blurred pedestrians and urban buildings.",
|
| 155 |
+
"is_nsfw": <span style="color: #4ade80;">false</span>,
|
| 156 |
+
"reason": "The image depicts a casual outdoor scene featuring two adults in everyday attire. There is no evidence of nudity, revealing undergarments, suggestive poses, or any sexually explicit content. The focus is on the interaction between the subjects.",
|
| 157 |
+
"nsfw": <span style="color: #4ade80;">0</span>,
|
| 158 |
+
"safe": <span style="color: #4ade80;">1</span>
|
| 159 |
+
}</pre>
|
| 160 |
+
</div>
|
| 161 |
+
|
| 162 |
+
<!-- Thin Line Bar -->
|
| 163 |
+
<hr style="border: 0; border-top: 1px solid #333333; margin: 0 0 32px 0;">
|
| 164 |
+
|
| 165 |
+
<!-- Card 2 (NSFW - Blurred) -->
|
| 166 |
+
<div style="margin-bottom: 32px;">
|
| 167 |
+
<div style="border-radius: 8px; overflow: hidden; margin-bottom: 16px; border: 1px solid #222; position: relative;">
|
| 168 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/CjoTJmmvn1HCjtc4ou0cT.png" alt="NSFW Image 2" style="width: 100%; height: auto; display: block; filter: blur(40px) saturate(0.5) brightness(0.8); transform: scale(1.2);">
|
| 169 |
+
</div>
|
| 170 |
+
<pre style="background-color: #0a0a0a; padding: 16px; border-radius: 8px; border: 1px solid #222; color: #e0e0e0; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; margin: 0;">
|
| 171 |
+
{
|
| 172 |
+
"caption": "A blonde woman is shown from behind, wearing red thong-style underwear. She has long hair and a visible tattoo on her lower back. Her hands are positioned near her hips, holding the straps of the thong. The setting appears to be a modern living room with a window and a patterned sofa.",
|
| 173 |
+
"is_nsfw": <span style="color: #4ade80;">1</span>,
|
| 174 |
+
"reason": "The image classifies as NSFW due to the presence of red thong-style underwear, which exposes the lower back and buttocks. The pose, where the subject is holding the thong straps, combined with the visible skin and lack of full coverage, meets the criteria for suggestive and revealing content.",
|
| 175 |
+
"nsfw": <span style="color: #4ade80;">1</span>,
|
| 176 |
+
"safe": <span style="color: #4ade80;">0</span>
|
| 177 |
+
}</pre>
|
| 178 |
+
</div>
|
| 179 |
+
|
| 180 |
+
<!-- Thin Line Bar -->
|
| 181 |
+
<hr style="border: 0; border-top: 1px solid #333333; margin: 0 0 32px 0;">
|
| 182 |
+
|
| 183 |
+
<!-- Card 3 -->
|
| 184 |
+
<div>
|
| 185 |
+
<div style="border-radius: 8px; overflow: hidden; margin-bottom: 16px; border: 1px solid #222;">
|
| 186 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/EX1Zg_-Up4va_44B3dONZ.jpeg" alt="Safe Image 3" style="width: 100%; height: auto; display: block;">
|
| 187 |
+
</div>
|
| 188 |
+
<pre style="background-color: #0a0a0a; padding: 16px; border-radius: 8px; border: 1px solid #222; color: #e0e0e0; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; margin: 0;">
|
| 189 |
+
{
|
| 190 |
+
"caption": "A medium-sized lioness with golden-brown fur walks across a grassy enclosure in a zoo setting. She is walking towards the camera, looking directly at the viewer. The background features large rocks, trees, and a thatched-roof structure, likely a viewing platform or shelter. The environment appears clean and well-maintained.",
|
| 191 |
+
"is_nsfw": <span style="color: #4ade80;">false</span>,
|
| 192 |
+
"reason": "The image depicts a standard outdoor scene featuring a lioness in a zoo environment. There is no evidence of nudity, revealing clothing, suggestive poses, or any sexually explicit content. The focus is entirely on the animal and its natural habitat.",
|
| 193 |
+
"nsfw": <span style="color: #4ade80;">0</span>,
|
| 194 |
+
"safe": <span style="color: #4ade80;">1</span>
|
| 195 |
+
}</pre>
|
| 196 |
+
</div>
|
| 197 |
+
|
| 198 |
+
</div>
|
| 199 |
+
|
| 200 |
+
---
|
| 201 |
+
|
| 202 |
## **Training Details**
|
| 203 |
|
| 204 |
| Setting | Value |
|