Update app.py(1)
Browse files
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(
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
| 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")
|