@@ -69,6 +69,9 @@ To train the models, run the following command:
69
69
python3 spam_detector_ai/trainer.py
70
70
```
71
71
72
+ :warning : ** Warning** : A module not found error may occur :warning :
73
+ If this happens, use an IDE to run the ` trainer.py ` file until a fix is implemented.
74
+
72
75
This will train all the models and save them as ` .joblib ` files in the models directory. For now, there is 3 models:
73
76
74
77
- ` naive_bayes.pkl `
@@ -171,6 +174,10 @@ If you have trained the models on new data, you can test them by running the fol
171
174
python test_and_tuning/test.py
172
175
```
173
176
177
+ :warning : ** Warning** : A module not found error may occur :warning :
178
+ If this happens, use an IDE to run the ` test.py ` file until a fix is implemented.
179
+
180
+
174
181
### Making Predictions
175
182
176
183
To use the spam detector in your Django project:
@@ -180,7 +187,7 @@ To use the spam detector in your Django project:
180
187
3 . Use the ` is_spam ` method to check if a message is spam.
181
188
182
189
``` python
183
- from spam_detector_ai.prediction import VotingSpamDetector
190
+ from spam_detector_ai.prediction.predict import VotingSpamDetector
184
191
185
192
# Create the spam detector
186
193
spam_detector = VotingSpamDetector()
@@ -236,7 +243,8 @@ def check_website_contact_form(request):
236
243
# Call the spam detection API
237
244
response = requests.post(
238
245
" https://spam-detection-api.adamspierredavid.com/v1/check-spam/" ,
239
- json = {' message' : message_with_subject} # Use json parameter instead of data
246
+ json = {' text' : message_with_subject} # Use json parameter instead of data
247
+ # You can also do `json={'message': message_with_subject}
240
248
)
241
249
242
250
is_spam = False
0 commit comments