Views
No views yet
cointegrated/rubert-tiny2 (дообученная)neutral (0)positive (1)negative (2)pip install transformers torch1from transformers import pipeline
2
3classifier = pipeline("text-classification", model="./sentiment-model-rus", tokenizer="./sentiment-model-rus", top_k=1)
4label_map = {0: "neutral", 1: "positive", 2: "negative"}
5
6raw_output = classifier("проведец честный, рекомендую", top_k=1)
7for pred in raw_output:
8 label_id = int(pred['label'].replace('LABEL_', ''))
9 pred['label'] = label_map[label_id]
10
11print(raw_output)