Update README.md
Browse files
README.md
CHANGED
@@ -40,6 +40,31 @@ model-index:
|
|
40 |
name: Accuracy
|
41 |
---
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
# SetFit with akhooli/sbert_ar_nli_500k_norm
|
44 |
|
45 |
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [akhooli/sbert_ar_nli_500k_norm](https://huggingface.co/akhooli/sbert_ar_nli_500k_norm) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.
|
|
|
40 |
name: Accuracy
|
41 |
---
|
42 |
|
43 |
+
Usage:
|
44 |
+
```python
|
45 |
+
pip install setfit
|
46 |
+
from setfit import SetFitModel
|
47 |
+
from unicodedata import normalize
|
48 |
+
|
49 |
+
# Download model from Hub
|
50 |
+
model = SetFitModel.from_pretrained("akhooli/setfit_ar_hs")
|
51 |
+
# Run inference
|
52 |
+
queries = [
|
53 |
+
"سكت دهراً و نطق كفراً",
|
54 |
+
"الخلاف ﻻ يفسد للود قضية.",
|
55 |
+
"أنت شخص منبوذ. احترم أسيادك.",
|
56 |
+
"دع المكارم ﻻ ترحل لبغيتها واقعد فإنك أنت الطاعم الكاسي",
|
57 |
+
]
|
58 |
+
queries_n = [normalize('NFKC', query) for query in queries]
|
59 |
+
preds = model.predict(queries_n)
|
60 |
+
print(preds)
|
61 |
+
# if you want to see the probabilities for each label
|
62 |
+
probas = model.predict_proba(queries_n)
|
63 |
+
print(probas)
|
64 |
+
```
|
65 |
+
|
66 |
+
The rest of this content is auto-generated.
|
67 |
+
|
68 |
# SetFit with akhooli/sbert_ar_nli_500k_norm
|
69 |
|
70 |
This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [akhooli/sbert_ar_nli_500k_norm](https://huggingface.co/akhooli/sbert_ar_nli_500k_norm) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.
|