text-classification / model /sentiment.py
manue
Update Dockerfile and sentiment model initialization for improved caching and remove obsolete model reference
7163daa
raw
history blame
353 Bytes
from transformers import pipeline, AutoModelForSequenceClassification, AutoTokenizer
from typing import Any
class Sentiment:
def __init__(self, line: str) -> (list | list[Any] | Any | None):
self.pipe = pipeline("text-classification", model="MilaNLProc/feel-it-italian-sentiment", use_cache=False)
self.result = self.pipe(line)