A Gradio-powered web application that performs sentiment analysis on financial headlines using FinBERT. The app classifies headlines as positive, negative, or neutral, making it useful for financial market sentiment analysis.
- Custom Input Analysis: Analyze your own financial headlines or news snippets
- Yahoo Finance Integration: Automatically fetch and analyze latest headlines from Yahoo Finance RSS feeds
- Color-Coded Results: Easy-to-interpret sentiment results with visual indicators
- π’ Green for positive sentiment
- π΄ Red for negative sentiment
- βͺ Gray for neutral sentiment
- Python 3.8 or higher
- pip (Python package installer)
- Clone the repository:
git clone https://github.com/kimon2199/financial-sentiment-analyzer.git
cd financial-sentiment-analyzer
- Install required packages:
pip3 install -r requirements.txt
- Log into Hugging Face:
cp .env.example .env
Add your Hugging Face token to the .env file.
- Start the application:
python3 -m financial_headline_analyzer.app
-
Open your web browser and navigate to the URL provided in the terminal (typically
http://127.0.0.1:7860
) -
Use the application:
- Enter custom headlines in the text area (one headline per line) and click "Analyze Sentiment on Custom Input"
- Or click "Analyze Sentiment on Yahoo Finance Headlines" to fetch and analyze latest headlines
- gradio - Web interface framework
- transformers - For FinBERT model
- torch - PyTorch for deep learning
- pandas - Data manipulation and analysis
- huggingface_hub - For logging into Hugging Face
- python-dotenv - For loading environment variables from .env file