Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,11 +5,17 @@ import torch
|
|
5 |
# Set page configuration
|
6 |
st.set_page_config(page_title="Spam Detection", page_icon="📧")
|
7 |
|
8 |
-
#
|
9 |
-
|
|
|
|
|
10 |
model = DistilBertForSequenceClassification.from_pretrained(model_path)
|
11 |
tokenizer = DistilBertTokenizerFast.from_pretrained(model_path)
|
12 |
|
|
|
|
|
|
|
|
|
13 |
# Function to predict spam
|
14 |
def predict_spam(text):
|
15 |
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=512)
|
|
|
5 |
# Set page configuration
|
6 |
st.set_page_config(page_title="Spam Detection", page_icon="📧")
|
7 |
|
8 |
+
# Use an absolute path to avoid ambiguity
|
9 |
+
import os
|
10 |
+
model_path = os.path.join(os.getcwd(), "fine_tuned_model") # Ensure it's treated as a local directory
|
11 |
+
|
12 |
model = DistilBertForSequenceClassification.from_pretrained(model_path)
|
13 |
tokenizer = DistilBertTokenizerFast.from_pretrained(model_path)
|
14 |
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
# Function to predict spam
|
20 |
def predict_spam(text):
|
21 |
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=512)
|