Update README.md
Browse files
README.md
CHANGED
@@ -35,21 +35,27 @@ probably proofread and complete it, then remove this comment. -->
|
|
35 |
|
36 |
# adult-content-identify-text
|
37 |
|
38 |
-
Support languages: English, Chinese, Japanese, Korean
|
39 |
|
40 |
-
Determine whether online sales products are adult content. Input: product title or description, Output results
|
41 |
|
42 |
判斷網路銷售商品是否屬於成人內容。輸入: 商品名稱文字,輸出結果: 0 未知, 1 成人內容, 2 一般商品。
|
43 |
|
44 |
# use transformers pipeline
|
45 |
```python
|
46 |
-
from transformers import pipeline
|
47 |
-
pipe = pipeline("text-classification", model="jiechau/adult-content-
|
|
|
|
|
|
|
|
|
48 |
#q = '男平織運動外套-立領外套 慢跑 路跑 藍黑螢光黃 L'
|
49 |
q = '情趣睡衣 性感睡衣 角色扮演 惹火 緊身連身 漆皮膠衣 黑 L'
|
50 |
result = pipe(q)
|
51 |
print(result)
|
|
|
52 |
# [{'label': 'adult_成人商品', 'score': 0.9994813799858093}]
|
|
|
53 |
```
|
54 |
|
55 |
### Framework versions
|
|
|
35 |
|
36 |
# adult-content-identify-text
|
37 |
|
38 |
+
Support languages: English, Chinese (both CN/TW), Japanese, Korean
|
39 |
|
40 |
+
Determine whether online sales products are adult content. Input: text of product title or description, Output results 0: Unknown, 1: Adult Content, 2: General Merchandise.
|
41 |
|
42 |
判斷網路銷售商品是否屬於成人內容。輸入: 商品名稱文字,輸出結果: 0 未知, 1 成人內容, 2 一般商品。
|
43 |
|
44 |
# use transformers pipeline
|
45 |
```python
|
46 |
+
from transformers import pipeline, AutoConfig
|
47 |
+
pipe = pipeline("text-classification", model="jiechau/adult-content-identify-text")
|
48 |
+
config = AutoConfig.from_pretrained("jiechau/adult-content-identify-text")
|
49 |
+
label2id = config.label2id
|
50 |
+
id2label = config.id2label
|
51 |
+
|
52 |
#q = '男平織運動外套-立領外套 慢跑 路跑 藍黑螢光黃 L'
|
53 |
q = '情趣睡衣 性感睡衣 角色扮演 惹火 緊身連身 漆皮膠衣 黑 L'
|
54 |
result = pipe(q)
|
55 |
print(result)
|
56 |
+
print(label2id[result[0]['label']])
|
57 |
# [{'label': 'adult_成人商品', 'score': 0.9994813799858093}]
|
58 |
+
# 1
|
59 |
```
|
60 |
|
61 |
### Framework versions
|