sentiment_analysis / src /model /infernce.py
Moncey10's picture
Upload 15 files
4112bd3 verified
raw
history blame contribute delete
343 Bytes
import pickle
import pandas as pd
class SentimentModel:
def __init__(self, model_path='artifacts/model.pkl'):
with open(model_path, 'rb') as f:
self.model = pickle.load(f)
def predict(self, text: str):
pred = self.model.predict([text])[0]
return "Positive" if pred == 1 else "Negative"