Spaces:
Running
Running
File size: 2,773 Bytes
9ecc3d2 11dfce2 c66b19a 0f7b2eb 11dfce2 5738f9e 11dfce2 5738f9e 11dfce2 9ecc3d2 11dfce2 9ecc3d2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | ---
title: FinBERT Sentiment Analyzer API
emoji: π
colorFrom: blue
colorTo: gray
sdk: docker
pinned: false
---
# π **FinBERT: Real-Time Financial Sentiment Analysis**
Machine Learning Pipeline, which analyses news headlines about finance and forecasts sentiments (Bullish, Bearish, and Neutral).
The project will train a BERT-based model with PyTorch, implement API prediction requests using FastAPI, and display visualization results on a React-Bootstrap web interface.
### π Project Links
* **Live Application:** [Link](https://portfolio-frontend-livid.vercel.app/projects/sentiment-analysis-with-bert)
* **Frontend Code:** [Github](https://github.com/mobadara/portfolio-frontend/blob/main/src/pages/projects/FinBERT.jsx)
* **Project Blog Post:** [Link](https://mobadara.medium.com/75740300902b?source=friends_link&sk=e145c95c5c6b232c3b3ba27eaf0b41fb)
* **Model Weights (Optional):** Hugging Face [mobadara/finbert-finetuned](https://huggingface.co/mobadara/finbert-finetuned)
---
## ποΈ System Architecture
* **Machine Learning:** PyTorch, Hugging Face `transformers`, Financial PhraseBank Dataset
* **Backend API:** Python, FastAPI, Uvicorn
* **Frontend UI:** React, React-Bootstrap
* **Database:** PostgreSQL (Neon/Supabase) via SQLAlchemy
---
## π§ The Machine Learning Pipeline
The core of this application is a fine-tuned NLP model.
1. **Base Model:** `ProsusAI/finbert`
2. **Fine-tuning:** Conducted in Google Colab using a T4 GPU.
3. **Training Data:** The Kaggle Financial PhraseBank dataset.
*(Check the `/notebooks` directory to see the complete PyTorch training loop, tokenization process, and evaluation metrics).*
---
## π How to Run Locally
### 1. Clone the Repository
copy the command below and run it in your favourite terminal.
```bash
git clone https://github.com/mobadara/finbert-sentiment-analyzer-api &&
cd finbert-sentiment-analyzer-api.git
```
### 2. Create a virtual environment
```
python -m venv venv
```
### 3. Activate the virtual environment
#### a. On Linux/Mac
```bash
source venv/bin/activate
```
#### b. On Windows
```bash
venv\Scripts\activate
```
### 4. Install Dependencies
```bash
pip install -r requirements.txt
```
### 5. Start the server
```bash
uvicorn app.main:app --reload
```
## π¨βπ» Author:
**Muyiwa J. Obadara**
[](https://linkedin.com/in/obadara-m)
[](https://twitter.com/m_obadara)
[](https://portfolio-frontend-livid.vercel.app)
|