Spaces:
Runtime error
Runtime error
File size: 464 Bytes
fb22d07 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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)
|