Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 721 Bytes

File metadata and controls

17 lines (11 loc) · 721 Bytes

Tweet Sentiment Analyzer (Inference Script)

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.

What the code does

  1. Cleans input text (lowercasing, removing URLs/mentions/hashtags, stripping non-letters).
  2. Loads a locally saved transformer model and tokenizer from sentiment_model/sentiment_model.
  3. Runs inference with PyTorch (no gradients, evaluation mode).
  4. Maps the predicted class index to a human-readable label: Negative, Neutral, or Positive.

Requirements

pip install -r requirements.txt