A Streamlit web application for performing real-time sentiment analysis using a Hugging Face Transformer model powered by PyTorch. The app classifies text as positive, negative, or neutral and displays confidence scores for each class.
- Real-time sentiment prediction from user input
- Transformer-based NLP pipeline via
transformersandtorch - Simple Streamlit UI with probability visualization
- Lightweight deployment that runs locally or in the cloud
app.py– Streamlit application entry point that loads the model and renders the UI.requirements.txt– Python dependencies needed to run the app.
- Python 3.10+ recommended
- Virtual environment tool such as
venvorconda
- Clone the repository and enter the project directory.
- Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt
Launch the Streamlit server from the project root:
streamlit run app.pyThe app will provide a local URL (typically http://localhost:8501) where you can enter text and view predicted sentiment labels with confidence scores.
- Model weights are downloaded at runtime; ensure outbound network access on first launch.
- For containerized deployments, cache the model by running the app once during the image build or specify a model path via environment configuration if you extend the code.
Issues and pull requests are welcome. Please ensure changes include appropriate tests or manual verification steps when applicable.