baLLseM / model /sentiment.py
hqms's picture
initial commit
8578816
raw
history blame contribute delete
505 Bytes
from model.model import Model
class SentimentAnalysis(Model):
def __init__(self) -> None:
self.model_name = None
self.tasks = "sentiment"
self.load_model(model_name="crypter70/IndoBERT-Sentiment-Analysis" , tasks=self.tasks)
def predict(self, sentences):
outputs = super().predict(sentences, self.tasks)
return {
"result": outputs["label"],
"score": outputs["score"]
}
sentiment = SentimentAnalysis()