RealFalconsAI commited on
Commit
188c4ec
1 Parent(s): 11d4610

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -1
README.md CHANGED
@@ -1,5 +1,6 @@
1
  ---
2
  license: apache-2.0
 
3
  ---
4
  # Model Card: Fine-Tuned Vision Transformer (ViT) for NSFW Image Classification
5
 
@@ -32,12 +33,15 @@ classifier(image)
32
  ``` markdown
33
 
34
  # Load model directly
 
 
35
  from transformers import AutoModelForImageClassification, ViTImageProcessor
36
 
 
37
  model = AutoModelForImageClassification.from_pretrained("RealFalconsAI/nsfw_image_detection")
38
  processor = ViTImageProcessor.from_pretrained('RealFalconsAI/nsfw_image_detection')
39
  with torch.no_grad():
40
- inputs = processor(images=<image>, return_tensors="pt")
41
  outputs = model(**inputs)
42
  logits = outputs.logits
43
 
 
1
  ---
2
  license: apache-2.0
3
+ pipeline_tag: image-classification
4
  ---
5
  # Model Card: Fine-Tuned Vision Transformer (ViT) for NSFW Image Classification
6
 
 
33
  ``` markdown
34
 
35
  # Load model directly
36
+ import torch
37
+ from PIL import Image
38
  from transformers import AutoModelForImageClassification, ViTImageProcessor
39
 
40
+ img = Image.open("<path_to_image_file>")
41
  model = AutoModelForImageClassification.from_pretrained("RealFalconsAI/nsfw_image_detection")
42
  processor = ViTImageProcessor.from_pretrained('RealFalconsAI/nsfw_image_detection')
43
  with torch.no_grad():
44
+ inputs = processor(images=img, return_tensors="pt")
45
  outputs = model(**inputs)
46
  logits = outputs.logits
47