p1atdev commited on
Commit
0814202
·
verified ·
1 Parent(s): b2fe3ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -3,8 +3,11 @@ from transformers import pipeline
3
 
4
  pipe = pipeline("text-classification", model="p1atdev/saikyou-shield-30m")
5
 
6
- def classify(text):
7
- return pipe(text)
 
 
 
8
 
9
  demo = gr.Interface(
10
  fn=classify,
 
3
 
4
  pipe = pipeline("text-classification", model="p1atdev/saikyou-shield-30m")
5
 
6
+ def classify(text):
7
+ return labels = {
8
+ item["label"]: item["score"]
9
+ for item in pipe(text, top_k=2)
10
+ }
11
 
12
  demo = gr.Interface(
13
  fn=classify,