Views
No views yet
1# Interest Analysis Model 🎯
2
3This is a fine-tuned version of `j-hartmann/emotion-english-distilroberta-base` for **intent analysis**, categorizing text into three classes:
4✅ **Disinterested**
5✅ **Neutral**
6✅ **Interested**
7
8It is useful for analyzing customer feedback, social media posts, and other text-based interactions to determine user intent.
9
10---
11
12## 🚀 Model Details
13- **Base Model**: [j-hartmann/emotion-english-distilroberta-base](https://huggingface.co/j-hartmann/emotion-english-distilroberta-base)
14- **Fine-Tuned For**: Intent analysis with **3 labels**
15- **Dataset**: Custom dataset based on user-defined categories
16- **Labels**:
17 - `0`: Disinterested
18 - `1`: Neutral
19 - `2`: Interested
20
21---
22
23## 📥 Installation
24To use this model, install the `transformers` library:
25```bash
26pip install transformers1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Load the model
5model_name = "Rafay-15/InterestAnalysisModel" # Replace with your Hugging Face model name
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSequenceClassification.from_pretrained(model_name)
8
9# Define label mapping
10id2label = {0: "disinterested", 1: "neutral", 2: "interested"}
11
12def predict(text):
13 """Predicts the intent category of the input text."""
14 inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
15
16 with torch.no_grad():
17 outputs = model(**inputs)
18
19 logits = outputs.logits
20 predicted_class = torch.argmax(logits, dim=1).item()
21
22 return id2label[predicted_class]
23
24# Test Example
25text = "I really love this product!"
26print(f"Text: {text} -> Predicted Label: {predict(text)}")| Text | Prediction |
|---|---|
| "I love this product!" | Interested ✅ |
| "I don’t really care about this." | Disinterested ❌ |
| "It's okay, I guess." | Neutral 😐 |