Note
This project is part of our Build Club e-learning. To get a guided tutorial please visit and enroll in our courses.
This project by Vincent Koc and Hung Nguyen demonstrates how to build a personalized AI Financial Advisor using Python, OpenAI's GPT model, and Google Sheets or local CSV data. It's designed for people who want to learn some basics of AI, particularly those with existing Python knowledge or beginners in the field.
This is a great project for learning about AI, finance, and Python. This project can easily be adapted to other datasets and LLMs as well as other financial advice use cases from financial planning to investment advice to retirement planning and even startups.
- Data extraction from Google Sheets or local CSV
- Transaction categorization using OpenAI's GPT model
- Generation of financial summaries and personalized advice
- PDF report generation
- Interactive Gradio UI for easy interaction with the advisor
- Jupyter notebooks for step-by-step analysis and UI creation
- Python 3.7+
- OpenAI API key
- Google Cloud Platform account with Google Sheets API enabled (if using Google Sheets)
- Required Python libraries (installed via pip)
First Option (Jupyter Notebook):
- Use the notebook notebook/01_financial-analysis-notebook.ipynb to setup your project and generate the data.
- Use the notebook notebook/02_gradio-gpt.ipynb to test the advisor interface.
Second Option (Python Script):
- Clone this repository
- Install required dependencies:
pip install -r requirements.txt
- Copy
example.env
to.env
and update the values:cp example.env .env
- Update the following variables in your
.env
file:OPENAI_API_KEY
: Your OpenAI API keyGOOGLE_APPLICATION_CREDENTIALS
: Path to your Google Cloud credentials JSON file (if using Google Sheets)USE_GOOGLE_SHEETS
: Set totrue
if using Google Sheets,false
if using local CSVDUMMY_DATA_SPREADSHEET
: URL of the dummy data Google Sheet (provided in the example.env)
notebook/
: Jupyter notebooks for analysis and UI creation01_financial-analysis-notebook.ipynb
: Step-by-step financial analysis02_gradio-gpt.ipynb
: Gradio UI integration with GPT
scripts/
: Python scripts for various functionalitiesdata_extraction.py
: Functions to load data from CSV or Google Sheetsfinancial_advice.py
: Generate personalized financial advicefinancial_summary.py
: Generate financial summariesgradio_ui.py
: Gradio UI setup and launchmain.py
: Main script to run the applicationreport_generation.py
: Generate PDF reportstransaction_categorization.py
: Categorize transactions using GPT
data/
: Directory for storing local CSV datadata.csv
: Example data
The data is a CSV file with the following columns:
Date
: The date of the transactionDescription
: The description of the transactionAmount
: The amount of the transactionCategory
: The category of the transaction
This synthetic data was generated using OpenAI's GPT-o1 Preview model.
Run the main script:
python main.py
This will start the Gradio UI, allowing you to interact with the AI Financial Advisor.
This project is open-source and available under the GPLv3 License.