huolongguo10 commited on
Commit
12e1d6a
1 Parent(s): 1a9a485

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -0
README.md CHANGED
@@ -1,3 +1,36 @@
1
  ---
2
  license: openrail
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: openrail
3
+ datasets:
4
+ - huolongguo10/insecure
5
+ language:
6
+ - en
7
+ library_name: transformers
8
+ pipeline_tag: text-classification
9
+ tags:
10
+ - code
11
  ---
12
+ # check_sec_tiny
13
+ 检查web参数安全性,支持多种payload(v0.1.2-tiny)
14
+
15
+ ## 类型
16
+ ```
17
+ LABEL_0: secure
18
+ LABEL_1: insecure(可能包含payload)
19
+ ```
20
+
21
+ ## 使用
22
+ ```python
23
+ import transformers
24
+ from transformers import BertTokenizer, DataCollatorWithPadding
25
+ from transformers import AutoModelForSequenceClassification
26
+ tokenizer = BertTokenizer.from_pretrained('huolongguo10/check_sec')
27
+ model = AutoModelForSequenceClassification.from_pretrained('huolongguo10/check_sec', num_labels=2)
28
+ import torch
29
+ def check(text):
30
+ inputs = tokenizer(text, return_tensors="pt")
31
+ with torch.no_grad():
32
+ logits = model(**inputs).logits
33
+ predicted_class_id = logits.argmax().item()
34
+ print(f'{logits.argmax().item()}:{text}')
35
+ return 'secure' if predicted_class_id==0 else 'insecure'
36
+ ```