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-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/ImageShield-MMCF-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/ImageShield-MMCF-2B") 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-2B") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/ImageShield-MMCF-2B", 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-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/ImageShield-MMCF-2B" # 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-2B", "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-2B
- SGLang
How to use prithivMLmods/ImageShield-MMCF-2B 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-2B" \ --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-2B", "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-2B" \ --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-2B", "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-2B with Docker Model Runner:
docker model run hf.co/prithivMLmods/ImageShield-MMCF-2B
Update README.md
Browse files
README.md
CHANGED
|
@@ -139,47 +139,56 @@ print(output_text[0])
|
|
| 139 |
|
| 140 |
## **Example Cards**
|
| 141 |
|
| 142 |
-
<div style="font-family: 'Courier New', Courier, monospace;
|
| 143 |
|
| 144 |
<!-- Card 1 -->
|
| 145 |
-
<div style="margin-bottom:
|
| 146 |
-
<
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
| 148 |
"caption": "Two female tennis players in white athletic wear are shaking hands on a tennis court, with a net between them. In the background, a woman in a blue uniform stands near a green wall, and a man in a navy blazer and white trousers observes.",
|
| 149 |
-
"is_nsfw": <span style="color: #
|
| 150 |
"reason": "The image depicts a standard sports scene featuring two female tennis players in professional attire (white skirts and tops) engaging in a handshake. The setting includes a tennis court, a net, and a line judge or official in the background. There is no evidence of nudity, revealing swimwear, suggestive poses, or any elements that would indicate an NSFW classification.",
|
| 151 |
-
"nsfw": <span style="color: #
|
| 152 |
-
"safe": <span style="color: #
|
| 153 |
}</pre>
|
| 154 |
</div>
|
| 155 |
|
| 156 |
-
<!--
|
| 157 |
-
<
|
| 158 |
|
| 159 |
-
<!-- Card 2 -->
|
| 160 |
-
<div style="margin-bottom:
|
| 161 |
-
<
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
| 163 |
"caption": "A close-up profile shot of a woman with tanned skin, wearing a yellow and white patterned fabric draped over her lower body. She is holding the fabric up to reveal her bare buttocks and hip area. Her upper body is largely exposed, showing cleavage and a bare chest, while her dark hair is styled loosely.",
|
| 164 |
-
"is_nsfw": <span style="color: #
|
| 165 |
"reason": "The image features significant nudity and exposure. The subject's buttocks and hip are fully visible, and her upper body is largely unclothed, exposing cleavage and a bare chest. The use of a patterned fabric draped over the body creates a suggestive, revealing aesthetic that aligns with the 'exposed' and 'suggestive' classification criteria.",
|
| 166 |
-
"nsfw": <span style="color: #
|
| 167 |
-
"safe": <span style="color: #
|
| 168 |
}</pre>
|
| 169 |
</div>
|
| 170 |
|
| 171 |
-
<!--
|
| 172 |
-
<
|
| 173 |
|
| 174 |
<!-- Card 3 -->
|
| 175 |
-
<div
|
| 176 |
-
<
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
| 178 |
"caption": "A young girl with blonde hair, wearing a blue soccer jersey and black shorts, is captured mid-air kicking a white soccer ball on a grassy hill. She is wearing white socks and cleats. The background is a clear, solid blue sky.",
|
| 179 |
-
"is_nsfw": <span style="color: #
|
| 180 |
"reason": "The image depicts an active sports scene featuring a child playing soccer. The subject is fully clothed in standard athletic gear (jersey, shorts, socks, cleats) and is engaged in a dynamic action pose. There is no evidence of nudity, revealing swimwear, suggestive poses, or any elements that would indicate NSFW content.",
|
| 181 |
-
"nsfw": <span style="color: #
|
| 182 |
-
"safe": <span style="color: #
|
| 183 |
}</pre>
|
| 184 |
</div>
|
| 185 |
|
|
|
|
| 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 |
<!-- Card 1 -->
|
| 145 |
+
<div style="margin-bottom: 32px;">
|
| 146 |
+
<div style="border-radius: 8px; overflow: hidden; margin-bottom: 16px; border: 1px solid #222;">
|
| 147 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/UnSXkoCSNmeiGF0OAGMO5.jpeg" alt="Safe Image 1" style="width: 100%; height: auto; display: block;">
|
| 148 |
+
</div>
|
| 149 |
+
<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;">
|
| 150 |
+
{
|
| 151 |
"caption": "Two female tennis players in white athletic wear are shaking hands on a tennis court, with a net between them. In the background, a woman in a blue uniform stands near a green wall, and a man in a navy blazer and white trousers observes.",
|
| 152 |
+
"is_nsfw": <span style="color: #4ade80;">false</span>,
|
| 153 |
"reason": "The image depicts a standard sports scene featuring two female tennis players in professional attire (white skirts and tops) engaging in a handshake. The setting includes a tennis court, a net, and a line judge or official in the background. There is no evidence of nudity, revealing swimwear, suggestive poses, or any elements that would indicate an NSFW classification.",
|
| 154 |
+
"nsfw": <span style="color: #4ade80;">0</span>,
|
| 155 |
+
"safe": <span style="color: #4ade80;">1</span>
|
| 156 |
}</pre>
|
| 157 |
</div>
|
| 158 |
|
| 159 |
+
<!-- Thin Line Bar -->
|
| 160 |
+
<hr style="border: 0; border-top: 1px solid #333333; margin: 0 0 32px 0;">
|
| 161 |
|
| 162 |
+
<!-- Card 2 (NSFW - Blurred) -->
|
| 163 |
+
<div style="margin-bottom: 32px;">
|
| 164 |
+
<div style="border-radius: 8px; overflow: hidden; margin-bottom: 16px; border: 1px solid #222; position: relative;">
|
| 165 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/FxCT2p4ZPucdVcPZT4c41.png" alt="NSFW Image 2" style="width: 100%; height: auto; display: block; filter: blur(30px) saturate(0.8); transform: scale(1.1);">
|
| 166 |
+
</div>
|
| 167 |
+
<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;">
|
| 168 |
+
{
|
| 169 |
"caption": "A close-up profile shot of a woman with tanned skin, wearing a yellow and white patterned fabric draped over her lower body. She is holding the fabric up to reveal her bare buttocks and hip area. Her upper body is largely exposed, showing cleavage and a bare chest, while her dark hair is styled loosely.",
|
| 170 |
+
"is_nsfw": <span style="color: #4ade80;">true</span>,
|
| 171 |
"reason": "The image features significant nudity and exposure. The subject's buttocks and hip are fully visible, and her upper body is largely unclothed, exposing cleavage and a bare chest. The use of a patterned fabric draped over the body creates a suggestive, revealing aesthetic that aligns with the 'exposed' and 'suggestive' classification criteria.",
|
| 172 |
+
"nsfw": <span style="color: #4ade80;">1</span>,
|
| 173 |
+
"safe": <span style="color: #4ade80;">0</span>
|
| 174 |
}</pre>
|
| 175 |
</div>
|
| 176 |
|
| 177 |
+
<!-- Thin Line Bar -->
|
| 178 |
+
<hr style="border: 0; border-top: 1px solid #333333; margin: 0 0 32px 0;">
|
| 179 |
|
| 180 |
<!-- Card 3 -->
|
| 181 |
+
<div>
|
| 182 |
+
<div style="border-radius: 8px; overflow: hidden; margin-bottom: 16px; border: 1px solid #222;">
|
| 183 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/ZwuWL28H1PlGcv70X4Dbt.jpeg" alt="Safe Image 3" style="width: 100%; height: auto; display: block;">
|
| 184 |
+
</div>
|
| 185 |
+
<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;">
|
| 186 |
+
{
|
| 187 |
"caption": "A young girl with blonde hair, wearing a blue soccer jersey and black shorts, is captured mid-air kicking a white soccer ball on a grassy hill. She is wearing white socks and cleats. The background is a clear, solid blue sky.",
|
| 188 |
+
"is_nsfw": <span style="color: #4ade80;">false</span>,
|
| 189 |
"reason": "The image depicts an active sports scene featuring a child playing soccer. The subject is fully clothed in standard athletic gear (jersey, shorts, socks, cleats) and is engaged in a dynamic action pose. There is no evidence of nudity, revealing swimwear, suggestive poses, or any elements that would indicate NSFW content.",
|
| 190 |
+
"nsfw": <span style="color: #4ade80;">0</span>,
|
| 191 |
+
"safe": <span style="color: #4ade80;">1</span>
|
| 192 |
}</pre>
|
| 193 |
</div>
|
| 194 |
|