File size: 1,588 Bytes
ecc8d04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Stock Sentiment Prediction
emoji: πŸ“ˆ
colorFrom: blue
colorTo: pink
sdk: docker
app_file: app.py
pinned: false
---

# πŸ“Š Stock Sentiment Analysis and Prediction

This Hugging Face Space provides real-time stock price prediction using LSTM models trained on historical stock data and sentiment analysis from Twitter/Reddit.

## πŸš€ Features

- πŸ“‰ Predict future stock prices (AAPL, AMZN, GOOG, MSFT, TSLA)
- πŸ’¬ Analyze sentiment of social media text (VADER)
- 🧠 Uses LSTM models trained on historical and sentiment-augmented data
- πŸ“ˆ Real-time stock data via Yahoo Finance

## 🧠 Tech Stack

- Flask (backend)
- TensorFlow (LSTM models)
- yFinance, PRAW, Tweepy (data collection)
- VADER (sentiment analysis)
- Matplotlib (charts)
- Hugging Face Spaces (deployment via Docker)

## πŸ§ͺ Usage

### Web Interface

- Choose a stock ticker and optionally enable sentiment-based prediction.
- Enter recent tweets/news/comments.
- Get predicted stock price, trend chart, and delta.

### API Endpoints

| Endpoint              | Method | Description                          |
|-----------------------|--------|--------------------------------------|
| `/predict`            | POST   | Predict stock price (HTML form)      |
| `/sentiment`          | GET/POST | Analyze text sentiment              |
| `/api/stock/<symbol>` | GET    | Get real-time stock data             |
| `/api/sentiment`      | POST   | API to get sentiment label and score|

## βš™οΈ Setup (Local)

```bash
pip install -r requirements.txt
export FLASK_SECRET_KEY="your-secret-key"
python app.py