init commit
This commit is contained in:
15
lab4/test_model.py
Normal file
15
lab4/test_model.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import joblib
|
||||
|
||||
vectorizer = joblib.load("vectorizer.joblib")
|
||||
clf = joblib.load("classifier.joblib")
|
||||
|
||||
print("Type text to classify. Ctrl+C or empty line to quit.\n")
|
||||
while True:
|
||||
text = input("> ").strip()
|
||||
if not text:
|
||||
break
|
||||
X = vectorizer.transform([text])
|
||||
pred = clf.predict(X)[0]
|
||||
verdict = "SPAM" if pred == 1 else "HAM"
|
||||
print(f"[{verdict}] {text}\n")
|
||||
|
||||
Reference in New Issue
Block a user