stanfordnlp/sst2
Viewer • Updated • 70k • 41.8k • 163
How to use Divi15/sentiment-classifier-demo-5729 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Divi15/sentiment-classifier-demo-5729") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Divi15/sentiment-classifier-demo-5729")
model = AutoModelForSequenceClassification.from_pretrained("Divi15/sentiment-classifier-demo-5729", device_map="auto")This model is based on distilbert-base-uncased-finetuned-sst-2-english and performs Sentiment analysis on English text (positive/negative classification).
This model was uploaded as part of a machine learning assignment demonstrating model deployment to Hugging Face Hub.
from transformers import pipeline
# Load the model
classifier = pipeline("sentiment-analysis", model="Divi15/sentiment-classifier-demo-5729")
# Make predictions
result = classifier("I love machine learning!")
print(result)
# Expected output: [{'label': 'POSITIVE', 'score': 0.9991}]
This model is intended for:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from transformers import pipeline
tokenizer = AutoTokenizer.from_pretrained("Divi15/sentiment-classifier-demo-5729")
model = AutoModelForSequenceClassification.from_pretrained("Divi15/sentiment-classifier-demo-5729")
classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
# Test examples
examples = [
"I absolutely love this!",
"This is terrible.",
"It's okay, nothing special."
]
for text in examples:
result = classifier(text)
print(f"Text: {text}")
print(f"Result: {result}")
print()
texts = [
"Great product, highly recommended!",
"Poor quality, very disappointed.",
"Average performance, could be better."
]
results = classifier(texts)
for text, result in zip(texts, results):
print(f"{text} -> {result['label']} ({result['score']:.3f})")
@misc{sentiment_classifier_demo_5729_2024,
title={Sentiment Classifier Demo 5729},
author={Your Name},
year={2024},
publisher={Hugging Face},
url={https://huggingface.co/Divi15/sentiment-classifier-demo-5729}
}
This model card was created as part of an educational assignment on model deployment and sharing.
Last updated: 2025-09-08