Views
No views yet
1from transformers import pipeline
2
3# Load the model
4classifier = pipeline("text-classification", model="Huggingm1r@n/hebrew-intent-classifier")
5
6# Make predictions
7result = classifier("שכחתי את הסיסמה שלי")
8print(result)
9# [{'label': 'שכחת סיסמה', 'score': 0.95}]
10
11# Test other examples
12examples = [
13 "רוצה לבטל את המנוי",
14 "כמה עולה החבילה",
15 "האתר לא עובד"
16]
17
18for text in examples:
19 result = classifier(text)
20 print(f"'{text}' -> {result[0]['label']} ({result[0]['score']:.2%})")1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Load model and tokenizer
5tokenizer = AutoTokenizer.from_pretrained("Huggingm1r@n/hebrew-intent-classifier")
6model = AutoModelForSequenceClassification.from_pretrained("Huggingm1r@n/hebrew-intent-classifier")
7
8def predict_intent(text):
9 inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
10
11 with torch.no_grad():
12 outputs = model(**inputs)
13 logits = outputs.logits
14 probabilities = torch.softmax(logits, dim=-1)
15
16 predicted_id = torch.argmax(logits, dim=-1).item()
17 predicted_label = model.config.id2label[predicted_id]
18 confidence = probabilities[0][predicted_id].item()
19
20 return predicted_label, confidence
21
22# Example
23intent, confidence = predict_intent("שכחתי את הסיסמה")
24print(f"Intent: {intent}, Confidence: {confidence:.2%}")| Hebrew Text | Predicted Intent | English Translation |
|---|---|---|
| שכחתי את הסיסמה שלי | שכחת סיסמה | I forgot my password |
| רוצה לבטל את המנוי | ביטול מנוי | Want to cancel subscription |
| כמה עולה החבילה | שאלה כללית | How much does the package cost |
| האתר לא עובד | תמיכה טכנית | The website doesn't work |
safetensors format for secure model storage1@misc{hebrew-intent-classifier-2025,
2 title={Hebrew Intent Classification Model for Customer Service},
3 author={Huggingm1r@n},
4 year={2025},
5 publisher={Hugging Face},
6 url={https://huggingface.co/Huggingm1r@n/hebrew-intent-classifier}
7}