Update README.md
Browse files
README.md
CHANGED
@@ -22,9 +22,12 @@ base_model:
|
|
22 |
```Python
|
23 |
from transformers import pipeline
|
24 |
|
25 |
-
|
26 |
-
emotion_classifier = pipeline(
|
27 |
-
|
|
|
|
|
|
|
28 |
|
29 |
texts = [
|
30 |
"I'm so happy today!",
|
@@ -35,7 +38,6 @@ texts = [
|
|
35 |
|
36 |
for text in texts:
|
37 |
result = emotion_classifier(text)
|
38 |
-
# 鎵撳嵃鍒嗙被缁撴灉
|
39 |
print(f"Text: {text}")
|
40 |
print(f"Emotion classification result: {result}\n")
|
41 |
|
|
|
22 |
```Python
|
23 |
from transformers import pipeline
|
24 |
|
25 |
+
# Ensure the model and tokenizer are loaded on the GPU by setting device=0
|
26 |
+
emotion_classifier = pipeline(
|
27 |
+
"text-classification",
|
28 |
+
model="XuehangCang/Emotion-Classification",
|
29 |
+
# device=0 # Use the first GPU device
|
30 |
+
)
|
31 |
|
32 |
texts = [
|
33 |
"I'm so happy today!",
|
|
|
38 |
|
39 |
for text in texts:
|
40 |
result = emotion_classifier(text)
|
|
|
41 |
print(f"Text: {text}")
|
42 |
print(f"Emotion classification result: {result}\n")
|
43 |
|