akhooli commited on
Commit
1b39034
1 Parent(s): 631ac54

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -1
README.md CHANGED
@@ -43,8 +43,33 @@ model-index:
43
  This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification.
44
  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.
45
  A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.
46
- It was trained on akhooli/ar_reviews_100k_3 dataset (4500 samples, as few shot) with 68.7% accuracy.
 
 
 
 
 
 
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  The rest of this model card is auto generated.
50
 
 
43
  This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification.
44
  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.
45
  A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.
46
+ It was trained on akhooli/ar_reviews_100k_3 dataset (4500 samples, as few shot) with 68.7% accuracy.
47
+ There are 3 labels in the dataset: 0: negative, 1:positive, 2:mixed/neutral.
48
+ Normalize the text before classifying as the model uses normalized text. Here's how to use the model:
49
+ ```python
50
+ pip install setfit
51
+ from setfit import SetFitModel
52
+ from unicodedata import normalize
53
 
54
+ # Download model from Hub
55
+ model = SetFitModel.from_pretrained("akhooli/setfit_ar_100k_reviews")
56
+ # Run inference
57
+ queries = [
58
+ "يغلي الماء عند 100 درجة مئوية",
59
+ "فعلا لقد أحببت ذلك الفيلم",
60
+ "🤮 اﻷناناس مع البيتزا؟ إنه غير محبذ",
61
+ "رأيت أناسا بائسين في الطريق",
62
+ "لم يعجبني المطعم رغم أن السعر مقبول",
63
+ "من باب جبر الخاطر هذه 3 نجوم لتقييم الخدمة",
64
+ "من باب جبر الخواطر، هذه نجمة واحدة لخدمة ﻻ تستحق"
65
+ ]
66
+ queries_n = [normalize('NFKC', query) for query in queries]
67
+ preds = model.predict(queries_n)
68
+ print(preds)
69
+ # if you want to see the probabilities for each label
70
+ probas = model.predict_proba(queries_n)
71
+ print(probas)
72
+ ```
73
 
74
  The rest of this model card is auto generated.
75