Views
No views yet
pip install deberta-emotion-predictor1from deberta_emotion_predictor import DeBERTaEmotionPredictor
2predictor = DeBERTaEmotionPredictor()
3result = predictor.predict_emotions("今日はとても嬉しい!")
4predictor.show_emotions(result)1import pandas as pd
2from deberta_emotion_predictor import DeBERTaEmotionPredictor
3
4# model_dir は、言語モデルとトークナイザがある場所を指しています
5predictor = DeBERTaEmotionPredictor()
6
7# サンプルテキスト(リスト形式)
8sample_texts = [
9 "そうだ 京都、行こう。",
10 "がんばるひとの、がんばらない時間。",
11 "わたしらしくをあたらしく",
12 "ピースはここにある。",
13 "結婚しなくても幸せになれるこの時代に、私は、あなたと結婚したいのです。",
14 "これからの地球のために一肌、脱ぎました。",
15 "自分は、きっと想像以上だ。",
16 "ハローしあわせ。",
17 "日本を、1枚で。"
18]
19res_df = predictor.predict_emotions(sample_texts)
20
21predictor.show_emotions(res_df)1pip install torch
2pip install transformers
3pip install pandas 1sample_texts = [
2 "そうだ 京都、行こう。",
3 "がんばるひとの、がんばらない時間。"
4]
5result_df = predictor.predict_emotions(sample_texts)
6predictor.show_emotions(result_df)1result_single = predictor.predict_emotions("新しい朝が来た。")
2print(result_single)print(result_df)deberta_emotion_predictor/
├── README.md # この説明ファイル
├── deberta_emotion_predictor.py # DeBERTaEmotionPredictor クラスの実装
│ └── tokenizer_DeBERTa_v3_large/ #トークナイザー
├── setup.py
├── pyproject.toml
├── README.md
├── LICENSE
└── usage.py