NIFTY 50 Stock Price Prediction using LSTM and Flask: AI Final Year Project with Source Code
Back to ProjectDon't worry if you've never set up a Python project before. Follow these steps in order and you'll have the dashboard running in about 15–20 minutes. Most of that time is TensorFlow downloading.
Extract the project. Unzip the folder you downloaded somewhere simple, like D:\projects\nifty-predictor. Avoid paths with spaces or very long names. Open Command Prompt or Terminal inside that folder.
Check your Python version. Run:
python --version
It should say 3.10.x. If it shows something else, you probably have several Python versions installed. On Windows, try py -3.10 --version instead.
Create a virtual environment.
python -m venv .venv
Then activate it.
Windows:
.venv\Scripts\activate
macOS / Linux:
source .venv/bin/activate
You'll see (.venv) at the start of the line. That means it worked.
Install the dependencies.
pip install -r requirements.txt
This installs Flask, pandas, numpy, scikit-learn, tensorflow, joblib and waitress. Grab a chai. This takes a few minutes.
Run the app.
python run.py
Open http://127.0.0.1:5000 in your browser. You should see the stock gallery.
(Optional) Run it in production mode.
python wsgi.py
This serves the app on port 8000 using Waitress, which works on Windows.
No environment variables or API keys are needed. The dataset and trained models are already included.
http://127.0.0.1:5000/healthz. It should show {"status": "ok", "symbols_loaded": 49}./stock/RELIANCE. You should see the candlestick chart, the backtest chart and a prediction card with RMSE, MAE, MAPE and R²./predict, pick TCS, then change the "predict as of" date to something in 2015. The forecast should update./api/symbols to confirm the API returns a JSON list of stocks..venv folder, and redo steps 3 and 4.run.py is still running in another terminal. Close it with Ctrl+C, or change the port number in run.py._lstm_model.keras, _scaler.gz and _config.json files are in the models/ folder.Still stuck? Message the CodeAj team with a screenshot of the error and we'll sort it out with you on a call.
Our team is here to assist you with installation and setup.