bilalzafar commited on
Commit
56b0e95
·
verified ·
1 Parent(s): ae2a1d5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -15
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 AutoTokenizer, AutoModelForSequenceClassification, pipeline
70
 
71
- model_name = "bilalzafar/cbdc-sentiment"
 
72
 
73
- tokenizer = AutoTokenizer.from_pretrained(model_name)
74
- model = AutoModelForSequenceClassification.from_pretrained(model_name)
 
 
75
 
76
- classifier = pipeline(
77
- "text-classification",
78
- model=model,
79
- tokenizer=tokenizer,
80
- truncation=True,
81
- padding=True,
82
- top_k=1 # return only the top prediction
83
- )
84
 
85
- text = "CBDCs will revolutionize payment systems and improve financial inclusion."
86
- print(classifier(text))
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)}]