Skip to content

FastAPI-based gold price prediction system using machine learning. Trained model and API for seamless usability. πŸ“ˆπŸ€–

License

Notifications You must be signed in to change notification settings

samadpls/GoldPredictAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GoldPredictAPI πŸ“ˆπŸ€–

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.

Files πŸ“‚

  • 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.

Dependencies πŸ› οΈ

  • FastAPI
  • Scikit-learn
  • NumPy
  • Pandas
  • Matplotlib
  • Seaborn

How to Use πŸš€

  1. Install dependencies:

    pip install -r requirements.txt
  2. Run the FastAPI application:

    uvicorn gld_predication:app --reload

    This will start the FastAPI server locally.

  3. Make predictions using Swagger:

    Open your web browser and go to http://127.0.0.1:8000/docs to access the Swagger UI.

    • Click on the /predict endpoint.

    • Click on the "Try it out" button.

    • Input the sample request data:

      {
        "SPX": 2671.91992,
        "USO": 14.0600,
        "SLV": 15.5100,
        "EUR_USD": 1.186789
      }
    • Click on the "Execute" button to make a prediction. demo

  4. 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
    }'

Additional Information ℹ️

  • 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 the pickle library and loaded by the FastAPI application for predictions.

License πŸ“„

This project is licensed under the MIT License - see the LICENSE file for details.


About

FastAPI-based gold price prediction system using machine learning. Trained model and API for seamless usability. πŸ“ˆπŸ€–

Topics

Resources

License

Stars

Watchers

Forks