Update README.md
Browse files
README.md
CHANGED
@@ -110,10 +110,27 @@ If you use this model in your research or applications, please cite our paper:
|
|
110 |
```python
|
111 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
112 |
|
|
|
113 |
tokenizer = AutoTokenizer.from_pretrained("bilalzafar/FinAI-BERT-IslamicBanks")
|
114 |
model = AutoModelForSequenceClassification.from_pretrained("bilalzafar/FinAI-BERT-IslamicBanks")
|
115 |
|
|
|
116 |
classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
```python
|
111 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
112 |
|
113 |
+
# Load tokenizer and model
|
114 |
tokenizer = AutoTokenizer.from_pretrained("bilalzafar/FinAI-BERT-IslamicBanks")
|
115 |
model = AutoModelForSequenceClassification.from_pretrained("bilalzafar/FinAI-BERT-IslamicBanks")
|
116 |
|
117 |
+
# Create the pipeline
|
118 |
classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
119 |
+
|
120 |
+
# Label mapping
|
121 |
+
label_map = {
|
122 |
+
"LABEL_0": "Non-AI",
|
123 |
+
"LABEL_1": "AI"
|
124 |
+
}
|
125 |
+
|
126 |
+
# Input text
|
127 |
+
text = "Our Shariah-compliant bank has deployed AI-driven credit risk assessment tools."
|
128 |
+
|
129 |
+
# Run classification
|
130 |
+
result = classifier(text)[0]
|
131 |
+
|
132 |
+
# Output
|
133 |
+
label = label_map.get(result['label'], result['label'])
|
134 |
+
score = result['score']
|
135 |
+
print(f"Classification: {label} | Score: {score:.4f}")
|
136 |
+
|