This project loads a fine-tuned Hugging Face transformer model for 3-class sentiment classification (Negative / Neutral / Positive) and provides a simple Python function to predict sentiment for a given text input.
- Cleans input text (lowercasing, removing URLs/mentions/hashtags, stripping non-letters).
- Loads a locally saved transformer model and tokenizer from
sentiment_model/sentiment_model. - Runs inference with PyTorch (no gradients, evaluation mode).
- Maps the predicted class index to a human-readable label:
Negative,Neutral, orPositive.
pip install -r requirements.txt