模型:
Souvikcmsa/BERT_sentiment_analysis
如果你在 huggingface 中搜索情感分析模型,你会找到一个来自 finiteautomata 的模型。他们的模型提供了微观和宏观 F1 分数约为 67%。看看这个模型,它有约 80% 的宏观和微观 F1 分数。
您可以使用 cURL 访问此模型:
$ curl -X POST -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"inputs": "I love AutoTrain"}' https://api-inference.huggingface.co/models/Souvikcmsa/autotrain-sentiment_analysis-762923428
或者 Python API:
from transformers import AutoModelForSequenceClassification, AutoTokenizer model = AutoModelForSequenceClassification.from_pretrained("Souvikcmsa/autotrain-sentiment_analysis-762923428", use_auth_token=True) tokenizer = AutoTokenizer.from_pretrained("Souvikcmsa/autotrain-sentiment_analysis-762923428", use_auth_token=True) inputs = tokenizer("I love AutoTrain", return_tensors="pt") outputs = model(**inputs)
或者
from transformers import pipeline classifier = pipeline("text-classification", model = "Souvikcmsa/BERT_sentiment_analysis") classifier("I loved Star Wars so much!")# Positive classifier("A soccer game with multiple males playing. Some men are playing a sport.")# Neutral