romnatall
deploy
26290c2
raw
history blame
475 Bytes
from joblib import load
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
import pickle
with open('pages/film_review/model/model_logreg_vectorizer.pkl', 'rb') as f:
vectorizer = pickle.load(f)
# Load the model
classifier = load('pages/film_review/model/model_logreg.joblib')
def predict_tfidf(text):
text_review_vectorized = vectorizer.transform([text])
prediction = classifier.predict(text_review_vectorized)
return prediction