pretrained= "dadangheksaputra/indonesia-bert-lexicon-sentiment-classification" model = AutoModelForSequenceClassification.from_pretrained(pretrained) tokenizer = AutoTokenizer.from_pretrained(pretrained) sentiment_analysis = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer) label_index = {'LABEL_0': 'positive', 'LABEL_1': 'neutral', 'LABEL_2': 'negative'} text = "sistem informasi aset, migrasi sistem informasi akademik" result = sentiment_analysis(neg_text) status = label_index[result[0]['label']] score = result[0]['score'] print(f'Text: {neg_text} | Label : {status} ({score * 100:.3f}%)')
- Downloads last month
- 186