Update README.md
Browse files
README.md
CHANGED
|
@@ -66,22 +66,20 @@ Note: On the **entire annotated dataset** (in-domain evaluation, no hold-out), t
|
|
| 66 |
## Usage
|
| 67 |
|
| 68 |
```python
|
| 69 |
-
from transformers import
|
| 70 |
|
| 71 |
-
|
|
|
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
truncation=True,
|
| 81 |
-
padding=True,
|
| 82 |
-
top_k=1 # return only the top prediction
|
| 83 |
-
)
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
# Example output: [{'label': 'positive', 'score': 0.9789}]
|
|
|
|
| 66 |
## Usage
|
| 67 |
|
| 68 |
```python
|
| 69 |
+
from transformers import pipeline
|
| 70 |
|
| 71 |
+
# Load pipeline
|
| 72 |
+
classifier = pipeline("text-classification", model="bilalzafar/CBDC-Sentiment")
|
| 73 |
|
| 74 |
+
# Example sentences
|
| 75 |
+
sentences = [
|
| 76 |
+
"CBDCs will revolutionize payment systems and improve financial inclusion."
|
| 77 |
+
]
|
| 78 |
|
| 79 |
+
# Predict
|
| 80 |
+
for s in sentences:
|
| 81 |
+
result = classifier(s, return_all_scores=False)[0]
|
| 82 |
+
print(f"{s}\n → {result['label']} (score={result['score']:.4f})\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
# Example output:
|
| 85 |
+
# [{CBDCs will revolutionize payment systems and improve financial inclusion. → positive (score=0.9789)}]
|
|
|