Spaces:
Runtime error
Runtime error
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) | |