This project implements a gold price prediction system using machine learning. The system is trained on historical gold price data and provides a FastAPI
-based API for making predictions.
-
gld_predication.py: FastAPI app with a pre-trained model, offering an API endpoint for gold price predictions.
-
Gold Price Prediction.ipynb: Jupyter Notebook for initial gold price data exploration, preprocessing, and training of the RandomForestRegressor model.
- FastAPI
- Scikit-learn
- NumPy
- Pandas
- Matplotlib
- Seaborn
-
Install dependencies:
pip install -r requirements.txt
-
Run the FastAPI application:
uvicorn gld_predication:app --reload
This will start the FastAPI server locally.
-
Make predictions using Swagger:
Open your web browser and go to http://127.0.0.1:8000/docs to access the Swagger UI.
-
Make predictions using curl:
Alternatively, you can use
curl
to make predictions:curl -X 'POST' \ 'http://127.0.0.1:8000/predict' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "SPX": 2671.91992, "USO": 14.0600, "SLV": 15.5100, "EUR_USD": 1.186789 }'
-
Colab Notebook: The
Gold Price Prediction.ipynb
file in Google Colab contains the initial exploration and model training. -
Model Saving: The trained model is saved as
gld_data.pkl
using thepickle
library and loaded by the FastAPI application for predictions.
This project is licensed under the MIT License - see the LICENSE file for details.