| title | Aurelius Stock Predictor |
|---|---|
| emoji | 📈 |
| colorFrom | green |
| colorTo | blue |
| sdk | gradio |
| app_file | gradio_app.py |
| python_version | 3.12 |
| pinned | false |
A web application that predicts short-term stock price movement (UP/DOWN) using a Conv1D-Transformer model trained on technical indicators and FinBERT news sentiment.
- 📈 3-day forward movement prediction with confidence score
- 📰 Real-time news sentiment via FinBERT
- 📊 Interactive charts with recent OHLCV data
- 💹 35+ technical indicators (RSI, MACD, Bollinger Bands, ATR, etc.)
- 🎨 Modern, responsive UI
- Python 3.8+
- Trained model files (produced by
train_v5.py):stock_model.keras— Conv1D-Transformer modelscaler.pkl— RobustScaler fitted on training datamodel_config.json— feature list, threshold, and hyperparametersfinbert_local/(optional) — local FinBERT weights; falls back toProsusAI/finbertfrom HuggingFace if missing
pip install -r requirements.txtIf you want hyperparameter tuning, also install:
pip install keras-tuner
If you don't have the model files yet, run the training script first:
python train_v5.pyThis downloads stock data for 8 tickers (2018–2025), engineers features, optionally runs KerasTuner hyperparameter search, and saves all artifacts to the project directory.
Set RUN_TUNER = False in train_v5.py to skip tuning and use default hyperparameters.
python gradio_app.pyThen open the local Gradio URL shown in the terminal.
Create a new Space with Gradio as the SDK and set the hardware to the
free option available for your account (for a free personal account, this may
be ZeroGPU). Upload the repository contents; the Space uses gradio_app.py as
its entry point. The first boot downloads
ProsusAI/finbert unless a local finbert/ directory is included.
The Space needs outbound network access at runtime for Yahoo Finance and GoogleNews. If either news source is unavailable, the app falls back to a zero sentiment score and still returns a price-based prediction.
- Enter a stock ticker (e.g.
GOOGL,AAPL,NVDA) - Click Predict
- View the UP/DOWN prediction with confidence percentage
- Check the price chart, recent OHLCV table, and sentiment breakdown
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Main web interface |
POST |
/api/predict |
Run prediction for a ticker |
GET |
/api/stock-info |
Get basic stock info |
POST /api/predict
// Request
{ "symbol": "GOOGL" }
// Response
{
"symbol": "GOOGL",
"prediction": "UP",
"confidence": 0.72,
"current_price": 175.4,
"sentiment_score": 0.18,
"articles_analysed": 12
}GET /api/stock-info?symbol=GOOGL
Returns current price, volume, and 52-week high/low.
.
├── train_v5.py # Training pipeline (Conv1D-Transformer + KerasTuner)
├── app.py # Flask backend
├── stock_model.keras # Trained model (generated by train_v5.py)
├── scaler.pkl # RobustScaler (generated by train_v5.py)
├── model_config.json # Feature list, threshold, hyperparameters
├── finbert_local/ # Local FinBERT weights (optional)
├── templates/
│ └── index.html # Main HTML template
├── static/
│ ├── css/
│ │ └── style.css
│ └── js/
│ └── main.js
├── requirements.txt
└── README.md
| Property | Value |
|---|---|
| Architecture | Conv1D stem + Transformer encoder |
| Training data | 8 US tech stocks, 2018–2025 |
| Features | 35 technical indicators + FinBERT sentiment |
| Lookback window | 20 trading days |
| Prediction target | 3-day forward return > 0.5% |
| Loss function | Focal loss (γ=2) |
| Threshold selection | Youden's J-statistic |
| Scaler | RobustScaler |
- Model not found — run
train_v5.pyfirst to generatestock_model.keras,scaler.pkl, andmodel_config.json - FinBERT missing — the app will fetch
ProsusAI/finbertfrom HuggingFace automatically; ensure you have an internet connection on first run - News fetch fails — prediction still works; sentiment defaults to 0
- Ticker not supported — the model was trained on large-cap US tech stocks; results on other sectors may be less reliable