NativeVex's picture
merge develop.milestone-3
fb22d07
raw
history blame
464 Bytes
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForSequenceClassification
def classify(model_string: str, *args, **kwargs):
tokenizer = AutoTokenizer.from_pretrained(model_string)
model = AutoModelForSequenceClassification.from_pretrained(model_string)
sentiment_pipeline = pipeline(
"sentiment-analysis",
model=model,
tokenizer=tokenizer
)
return sentiment_pipeline(*args, **kwargs)