Spaces:
Sleeping
Sleeping
Create Readme.md
Browse files
Readme.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Stock Sentiment Prediction
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_file: app.py
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# π Stock Sentiment Analysis and Prediction
|
| 12 |
+
|
| 13 |
+
This Hugging Face Space provides real-time stock price prediction using LSTM models trained on historical stock data and sentiment analysis from Twitter/Reddit.
|
| 14 |
+
|
| 15 |
+
## π Features
|
| 16 |
+
|
| 17 |
+
- π Predict future stock prices (AAPL, AMZN, GOOG, MSFT, TSLA)
|
| 18 |
+
- π¬ Analyze sentiment of social media text (VADER)
|
| 19 |
+
- π§ Uses LSTM models trained on historical and sentiment-augmented data
|
| 20 |
+
- π Real-time stock data via Yahoo Finance
|
| 21 |
+
|
| 22 |
+
## π§ Tech Stack
|
| 23 |
+
|
| 24 |
+
- Flask (backend)
|
| 25 |
+
- TensorFlow (LSTM models)
|
| 26 |
+
- yFinance, PRAW, Tweepy (data collection)
|
| 27 |
+
- VADER (sentiment analysis)
|
| 28 |
+
- Matplotlib (charts)
|
| 29 |
+
- Hugging Face Spaces (deployment via Docker)
|
| 30 |
+
|
| 31 |
+
## π§ͺ Usage
|
| 32 |
+
|
| 33 |
+
### Web Interface
|
| 34 |
+
|
| 35 |
+
- Choose a stock ticker and optionally enable sentiment-based prediction.
|
| 36 |
+
- Enter recent tweets/news/comments.
|
| 37 |
+
- Get predicted stock price, trend chart, and delta.
|
| 38 |
+
|
| 39 |
+
### API Endpoints
|
| 40 |
+
|
| 41 |
+
| Endpoint | Method | Description |
|
| 42 |
+
|-----------------------|--------|--------------------------------------|
|
| 43 |
+
| `/predict` | POST | Predict stock price (HTML form) |
|
| 44 |
+
| `/sentiment` | GET/POST | Analyze text sentiment |
|
| 45 |
+
| `/api/stock/<symbol>` | GET | Get real-time stock data |
|
| 46 |
+
| `/api/sentiment` | POST | API to get sentiment label and score|
|
| 47 |
+
|
| 48 |
+
## βοΈ Setup (Local)
|
| 49 |
+
|
| 50 |
+
```bash
|
| 51 |
+
pip install -r requirements.txt
|
| 52 |
+
export FLASK_SECRET_KEY="your-secret-key"
|
| 53 |
+
python app.py
|