Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
-
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
|
4 |
|
5 |
# Load the model and tokenizer from Hugging Face
|
6 |
model_name = "crimson78/spam_classifier" # Replace with your model's actual name
|
7 |
-
tokenizer =
|
8 |
-
model =
|
9 |
|
10 |
# Define label mapping (Assuming 0 = HAM, 1 = SPAM)
|
11 |
LABELS = {0: "HAM", 1: "SPAM"}
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
# from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
4 |
+
from transformers import BertTokenizer, BertForSequenceClassification
|
5 |
|
6 |
# Load the model and tokenizer from Hugging Face
|
7 |
model_name = "crimson78/spam_classifier" # Replace with your model's actual name
|
8 |
+
tokenizer = BertTokenizer.from_pretrained(model_name)
|
9 |
+
model = BertForSequenceClassification.from_pretrained(model_name)
|
10 |
|
11 |
# Define label mapping (Assuming 0 = HAM, 1 = SPAM)
|
12 |
LABELS = {0: "HAM", 1: "SPAM"}
|