Anuj02003 commited on
Commit
2ad92aa
·
verified ·
1 Parent(s): 261e9be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
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
- # Load the local fine-tuned model and tokenizer
9
- model_path = "./fine_tuned_model"
 
 
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)