Subhajit01 commited on
Commit
3e3821a
·
verified ·
1 Parent(s): 41570b0

Update app.py(1)

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -5,11 +5,12 @@ model_id = "Subhajit01/spam_detector_powered_by_custom_GPT"
5
  classifier = pipeline("text-classification", model=model_id, tokenizer="gpt2")
6
  labels = ["spam", "not spam"]
7
 
8
- def classify(result):
9
- if result[0]["label"] == 'LABEL_0':
10
- print(labels[0])
11
- else:
12
- print(labels[1])
 
13
 
14
  with gr.Blocks() as demo:
15
  gr.Markdown("# Spam Detection System")
 
5
  classifier = pipeline("text-classification", model=model_id, tokenizer="gpt2")
6
  labels = ["spam", "not spam"]
7
 
8
+ def classify(text):
9
+ result = classifier(text)
10
+ if result[0]["label"] == 'LABEL_0':
11
+ return labels[0]
12
+ else:
13
+ return labels[1]
14
 
15
  with gr.Blocks() as demo:
16
  gr.Markdown("# Spam Detection System")