why's this taking so long
47a68c5
raw
history blame contribute delete
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)