File size: 1,684 Bytes
51eb7e7
945da84
 
 
 
170b5d8
 
 
 
 
 
 
 
6c48d0c
 
 
 
 
 
 
51eb7e7
945da84
8e0a9ba
 
 
 
 
 
945da84
 
6b56a29
 
 
 
 
 
64e0bbd
 
945da84
 
6b56a29
945da84
6b56a29
945da84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
model-index:
- name: adult-content-classifier-image
  results: []
pipeline_tag: image-classification
tags:
  - adult-content-classifier-image
  - classifier
  - adult
  - adult-content
  - image-classifier
  - image
  - classifier
#widget:
#  - text: "https://img.shopping.friday.tw/images/product/265/7951356/7951356_3_1.webp?172830"
#    src: "https://img.shopping.friday.tw/images/product/265/7951356/7951356_3_1.webp?172830"
#    example_title: "regular_一般商品圖片"
#  - text: "https://img.shopping.friday.tw/images/product/259/7782883/7782883_3_1.webp?153546"
#    src: "https://img.shopping.friday.tw/images/product/259/7782883/7782883_3_1.webp?153546"
#    example_title: "adult_成人商品圖片"
---

# adult-content-identify-image

Determine whether online sales products are adult content. Input: image content, Output results: 0 Unknown, 1 Adult Content, 2 General Merchandise.

判斷網路銷售商品是否屬於成人內容。輸入圖片內容,輸出結果: 0 未知, 1 成人內容, 2 一般商品。

# use transformers pipeline
```python
from transformers import pipeline, AutoConfig
pipe = pipeline("image-classification", model="jiechau/adult-content-identify-image")
config = AutoConfig.from_pretrained("jiechau/adult-content-identify-image")
label2id = config.label2id
id2label = config.id2label

q = 'https://xxx.xxx.xxx/images/xxx/xxx.webp'
q = 'https://xxx.xxx.xxx/images/xxx/xxx.jpg'
result = pipe(q)
print(result)
print(label2id[result[0]['label']])
# [{'label': 'adult_成人商品', 'score': 0.7516837120056152}, {'label': 'regular_一般商品', 'score': 0.2475457787513733}, {'label': 'unknown', 'score': 0.0007705678581260145}]
# 1
```