Johnson8187
commited on
Commit
•
5ec3bc0
1
Parent(s):
0f958db
Update README.md
Browse files
README.md
CHANGED
@@ -55,7 +55,7 @@ label_mapping = {
|
|
55 |
7: "厭惡語調"
|
56 |
}
|
57 |
|
58 |
-
def predict_emotion(text, model_path="
|
59 |
# 載入模型和分詞器
|
60 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
61 |
model = AutoModelForSequenceClassification.from_pretrained(model_path).to(device) # 移動模型到設備
|
@@ -90,6 +90,7 @@ if __name__ == "__main__":
|
|
90 |
emotion = predict_emotion(text)
|
91 |
print(f"文本: {text}")
|
92 |
print(f"預測情緒: {emotion}\n")
|
|
|
93 |
```
|
94 |
|
95 |
---
|
|
|
55 |
7: "厭惡語調"
|
56 |
}
|
57 |
|
58 |
+
def predict_emotion(text, model_path="Johnson8187/chinese-text-emotion-classifier"):
|
59 |
# 載入模型和分詞器
|
60 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
61 |
model = AutoModelForSequenceClassification.from_pretrained(model_path).to(device) # 移動模型到設備
|
|
|
90 |
emotion = predict_emotion(text)
|
91 |
print(f"文本: {text}")
|
92 |
print(f"預測情緒: {emotion}\n")
|
93 |
+
|
94 |
```
|
95 |
|
96 |
---
|