This app fetches NYTimes articles for a chosen topic, processes text with NLTK, and computes a majority sentiment label across headline, snippet, and abstract.
- Create a
.envfile in the project root with your NYTimes API key:
API_KEY=YOUR_NYTIMES_API_KEY
Note: Avoid spaces around the variable name (e.g., use NEWS_API not NEWS_API =).
- (Recommended) Use a virtual environment:
/usr/bin/python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt- If you're using Anaconda base environment and encounter protobuf errors, use the Python implementation:
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
streamlit run app.py- In a clean virtual environment:
streamlit run app.pyOpen the URL shown (usually http://localhost:8501) and enter a topic, then click "Get Data" to fetch and analyze articles.