DenisNovac commited on
Commit
be8ce09
1 Parent(s): d19449b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -0
README.md CHANGED
@@ -6,6 +6,32 @@ pipeline_tag: image-classification
6
  Copyright: Falcons.ai
7
  Forked from: https://huggingface.co/Falconsai/nsfw_image_detection/tree/main
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  # Model Card: Fine-Tuned Vision Transformer (ViT) for NSFW Image Classification
10
 
11
  ## Model Description
 
6
  Copyright: Falcons.ai
7
  Forked from: https://huggingface.co/Falconsai/nsfw_image_detection/tree/main
8
 
9
+ DJL project that uses the model: https://github.com/Baklanov-Soft/image-hosting-processing
10
+
11
+ `converted-to-torchscript.pt` - converted to TorchScript (to be used in DJL) by script:
12
+
13
+ ```python
14
+ from PIL import Image
15
+ from transformers import AutoTokenizer
16
+
17
+ model_name = "Falconsai/nsfw_image_detection"
18
+
19
+ model = AutoModelForImageClassification.from_pretrained(model_name, torchscript=True, return_dict=False)
20
+
21
+ processor = AutoImageProcessor.from_pretrained(model_name)
22
+
23
+ # example nsfw picture to trigger the model, find it yourself
24
+ image = Image.open("images/hentai.jpg")
25
+ image_inputs = processor(images=image, return_tensors="pt")
26
+
27
+ config = {'forward': [image_inputs['pixel_values']]}
28
+ converted = torch.jit.trace_module(model, config)
29
+
30
+ torch.jit.save(converted, "converted.pt")
31
+ ```
32
+
33
+
34
+
35
  # Model Card: Fine-Tuned Vision Transformer (ViT) for NSFW Image Classification
36
 
37
  ## Model Description