Update README.md
Browse files
README.md
CHANGED
|
@@ -78,25 +78,25 @@ predicted_label = outputs.logits.argmax().item()
|
|
| 78 |
# Example Usage
|
| 79 |
```python
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
model = AutoModelForSequenceClassification.from_pretrained("your-model-name")
|
| 84 |
-
tokenizer = AutoTokenizer.from_pretrained("your-tokenizer-name")
|
| 85 |
|
| 86 |
-
#
|
|
|
|
|
|
|
| 87 |
|
|
|
|
| 88 |
text = "This is a great movie!"
|
| 89 |
tokenized_input = tokenizer(text, return_tensors="pt")
|
| 90 |
|
| 91 |
-
#Perform sentiment analysis
|
| 92 |
-
|
| 93 |
outputs = model(**tokenized_input)
|
| 94 |
predicted_label = outputs.logits.argmax().item()
|
| 95 |
|
| 96 |
-
#Print predicted sentiment
|
| 97 |
sentiment_labels = ["negative", "neutral", "positive"]
|
| 98 |
print(f"Predicted Sentiment: {sentiment_labels[predicted_label]}")
|
| 99 |
|
|
|
|
| 100 |
```
|
| 101 |
# Model Architecture and Objective
|
| 102 |
|
|
|
|
| 78 |
# Example Usage
|
| 79 |
```python
|
| 80 |
|
| 81 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
+
# Load the model and tokenizer
|
| 84 |
+
model = AutoModelForSequenceClassification.from_pretrained("saishshinde15/SentimentTensor")
|
| 85 |
+
tokenizer = AutoTokenizer.from_pretrained("saishshinde15/SentimentTensor")
|
| 86 |
|
| 87 |
+
# Tokenize text data
|
| 88 |
text = "This is a great movie!"
|
| 89 |
tokenized_input = tokenizer(text, return_tensors="pt")
|
| 90 |
|
| 91 |
+
# Perform sentiment analysis
|
|
|
|
| 92 |
outputs = model(**tokenized_input)
|
| 93 |
predicted_label = outputs.logits.argmax().item()
|
| 94 |
|
| 95 |
+
# Print predicted sentiment
|
| 96 |
sentiment_labels = ["negative", "neutral", "positive"]
|
| 97 |
print(f"Predicted Sentiment: {sentiment_labels[predicted_label]}")
|
| 98 |
|
| 99 |
+
|
| 100 |
```
|
| 101 |
# Model Architecture and Objective
|
| 102 |
|