1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="ohanvi/ohanvi-sentiment-analysis",
6)
7
8result = classifier("This movie was absolutely fantastic!")
9# → [{'label': 'positive', 'score': 0.9978}]
10
11result = classifier("Terrible film, complete waste of time.")
12# → [{'label': 'negative', 'score': 0.9965}]
The model was fine-tuned on the full
IMDb dataset:
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_name = "ohanvi/ohanvi-sentiment-analysis"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForSequenceClassification.from_pretrained(model_name)
7model.eval()
8
9text = "An outstanding film with incredible performances."
10inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
11
12with torch.no_grad():
13 logits = model(**inputs).logits
14
15probs = torch.softmax(logits, dim=-1)
16label_id = probs.argmax().item()
17label = model.config.id2label[label_id]
18confidence = probs[0][label_id].item()
19
20print(f"Label: {label} ({confidence:.1%})")
1@misc{ohanvi-sentiment-2026,
2 title = {Ohanvi Sentiment Analysis},
3 author = {Gourav Bansal},
4 year = {2026},
5 url = {https://huggingface.co/ohanvi/ohanvi-sentiment-analysis},
6}