Abdulrahman Al-Ghamdi
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -118,33 +118,6 @@ print(result)
|
|
118 |
|
119 |
---
|
120 |
|
121 |
-
### **2️⃣ Use Model with `AutoModelForSequenceClassification`**
|
122 |
-
For **batch processing & lower latency**, use the `AutoModel` API:
|
123 |
-
```python
|
124 |
-
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
125 |
-
import torch
|
126 |
-
|
127 |
-
model_name = "Abduuu/ArabReview-Sentiment"
|
128 |
-
|
129 |
-
# Load Model & Tokenizer
|
130 |
-
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
131 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
132 |
-
|
133 |
-
# Example Review
|
134 |
-
review = "الخدمة كانت بطيئة والطعام غير جيد."
|
135 |
-
inputs = tokenizer(review, return_tensors="pt")
|
136 |
-
|
137 |
-
# Perform Inference
|
138 |
-
with torch.no_grad():
|
139 |
-
logits = model(**inputs).logits
|
140 |
-
prediction = torch.argmax(logits).item()
|
141 |
-
|
142 |
-
label_map = {0: "Negative", 1: "Positive"}
|
143 |
-
print(f"Predicted Sentiment: {label_map[prediction]}")
|
144 |
-
```
|
145 |
-
|
146 |
-
---
|
147 |
-
|
148 |
## **🔬 Model Performance (Real Examples)**
|
149 |
| Review | Prediction |
|
150 |
|--------|------------|
|
|
|
118 |
|
119 |
---
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
## **🔬 Model Performance (Real Examples)**
|
122 |
| Review | Prediction |
|
123 |
|--------|------------|
|