Update README.md
Browse files
README.md
CHANGED
@@ -85,6 +85,7 @@ The predicted_scores here are probabilities between 0 and 1, and their sum will
|
|
85 |
|
86 |
```python
|
87 |
# install these packages before importing them (transformers, PyTorch)
|
|
|
88 |
|
89 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
90 |
import torch
|
@@ -100,8 +101,7 @@ if use_file:
|
|
100 |
with open(file_path, 'r', encoding='utf-8') as file:
|
101 |
new_text = file.read()
|
102 |
else:
|
103 |
-
new_text = "President Joe Biden said on Wednesday he pulled out of the race against Republican Donald Trump over concerns about the future of U.S. democracy, explaining he was stepping aside to allow a new generation to take over in his first public remarks since ending his re-election bid.
|
104 |
-
In an Oval Office address, Biden invoked previous presidents Thomas Jefferson, George Washington, and Abraham Lincoln as he described his love for the office that he will leave in six months, capping a half century in public office."
|
105 |
|
106 |
# Encode the text using the same tokenizer used during training
|
107 |
encoded_input = tokenizer(new_text, return_tensors='pt', padding=True, truncation=True, max_length=64)
|
@@ -124,11 +124,12 @@ for trait, score in zip(trait_names, predicted_scores):
|
|
124 |
print(f"{trait}: {score:.4f}")
|
125 |
|
126 |
##"output":
|
127 |
-
#Agreeableness: 0.
|
128 |
-
#Openness: 0.
|
129 |
-
#Conscientiousness: 0.
|
130 |
-
#Extraversion: 0.
|
131 |
-
#Neuroticism: 0.
|
|
|
132 |
|
133 |
```
|
134 |
|
|
|
85 |
|
86 |
```python
|
87 |
# install these packages before importing them (transformers, PyTorch)
|
88 |
+
# install these packages before importing them (transformers, PyTorch)
|
89 |
|
90 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
91 |
import torch
|
|
|
101 |
with open(file_path, 'r', encoding='utf-8') as file:
|
102 |
new_text = file.read()
|
103 |
else:
|
104 |
+
new_text = "President Joe Biden said on Wednesday he pulled out of the race against Republican Donald Trump over concerns about the future of U.S. democracy, explaining he was stepping aside to allow a new generation to take over in his first public remarks since ending his re-election bid. In an Oval Office address, Biden invoked previous presidents Thomas Jefferson, George Washington, and Abraham Lincoln as he described his love for the office that he will leave in six months, capping a half century in public office."
|
|
|
105 |
|
106 |
# Encode the text using the same tokenizer used during training
|
107 |
encoded_input = tokenizer(new_text, return_tensors='pt', padding=True, truncation=True, max_length=64)
|
|
|
124 |
print(f"{trait}: {score:.4f}")
|
125 |
|
126 |
##"output":
|
127 |
+
#Agreeableness: 0.1982
|
128 |
+
#Openness: 0.2678
|
129 |
+
#Conscientiousness: 0.1857
|
130 |
+
#Extraversion: 0.1346
|
131 |
+
#Neuroticism: 0.2137
|
132 |
+
|
133 |
|
134 |
```
|
135 |
|