akhooli commited on
Commit
1609b4b
1 Parent(s): 81358f8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -0
README.md CHANGED
@@ -34,6 +34,32 @@ model-index:
34
  name: Accuracy
35
  ---
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  # SetFit with akhooli/sbert_ar_nli_500k_norm
38
 
39
  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.
 
34
  name: Accuracy
35
  ---
36
 
37
+ # usage
38
+ Usage:
39
+ ```python
40
+ pip install setfit
41
+ from setfit import SetFitModel
42
+ from unicodedata import normalize
43
+
44
+ # Download model from Hub
45
+ model = SetFitModel.from_pretrained("akhooli/setfit_ar_hs")
46
+ # Run inference
47
+ queries = [
48
+ "سكت دهراً و نطق كفراً",
49
+ "الخلاف ﻻ يفسد للود قضية.",
50
+ "أنت شخص منبوذ. احترم أسيادك.",
51
+ "دع المكارم ﻻ ترحل لبغيتها واقعد فإنك أنت الطاعم الكاسي",
52
+ ]
53
+ queries_n = [normalize('NFKC', query) for query in queries]
54
+ preds = model.predict(queries_n)
55
+ print(preds)
56
+ # if you want to see the probabilities for each label
57
+ probas = model.predict_proba(queries_n)
58
+ print(probas)
59
+ ```
60
+
61
+ The rest of this content is auto-generated.
62
+
63
  # SetFit with akhooli/sbert_ar_nli_500k_norm
64
 
65
  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.