File size: 343 Bytes
4112bd3
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
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"