Spaces:
Sleeping
Sleeping
File size: 428 Bytes
377ca3f 5b4ebfb 377ca3f 5b4ebfb 377ca3f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from joblib import load
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
import pickle
with open('models/logreg_vec.pkl', 'rb') as f:
vectorizer = pickle.load(f)
# Load the model
classifier = load('models/logreg_model.joblib')
def predict_tfidf(text):
text_review_vectorized = vectorizer.transform([text])
prediction = classifier.predict(text_review_vectorized)
return prediction |