Mohamed-Maher commited on
Commit
607ce83
·
verified ·
1 Parent(s): 1c5166c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -12,14 +12,20 @@ class HadithClassificationApp:
12
  # Download NLTK resources if needed
13
  nltk.download('punkt')
14
 
 
 
 
 
 
 
15
  # Load the dataset and labels
16
- self.dataset = pd.read_csv("/home/user/app/Preprocess_LK_Hadith_dataset.csv")
17
  self.labels = self.dataset['Arabic_Grade']
18
 
19
  # Load the models
20
- with open("tfidf_vectorizer.pkl", "rb") as f:
21
  self.vectorizer = pickle.load(f)
22
- with open("cosine_similarity_model.pkl", "rb") as f:
23
  self.X = pickle.load(f)
24
 
25
  @staticmethod
 
12
  # Download NLTK resources if needed
13
  nltk.download('punkt')
14
 
15
+ # Define file paths
16
+ base_path = os.path.dirname(__file__)
17
+ dataset_path = os.path.join(base_path, "Preprocess_LK_Hadith_dataset.csv")
18
+ vectorizer_path = os.path.join(base_path, "tfidf_vectorizer.pkl")
19
+ similarity_model_path = os.path.join(base_path, "cosine_similarity_model.pkl")
20
+
21
  # Load the dataset and labels
22
+ self.dataset = pd.read_csv(dataset_path)
23
  self.labels = self.dataset['Arabic_Grade']
24
 
25
  # Load the models
26
+ with open(vectorizer_path, "rb") as f:
27
  self.vectorizer = pickle.load(f)
28
+ with open(similarity_model_path, "rb") as f:
29
  self.X = pickle.load(f)
30
 
31
  @staticmethod