Skip to content
Financial Scenario Generator
Financial Scenario Generator
This is a Flask web application that allows users to upload financial data files (in CSV format) and generates a fictitious tax/financial scenario based on the uploaded data. The scenario is created using OpenAI's API, which analyzes the financial data and simulates potential impacts on the business.
Features
- Upload multiple CSV files containing financial data.
- Automatically processes and cleans the uploaded data.
- Generates a customized tax/financial scenario using OpenAI's API.
- Easy-to-use web interface for uploading files.
Prerequisites
- Python 3.x
- Flask
- Pandas
- OpenAI Python client
Installation
- Create and activate a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install the required Python packages:
pip install Flask, openai, pandas
- Set up your OpenAI API key:
openai.api_key = 'your_api_key'
Usage
- Run the Flask app:
python app.py
2. Open your web browser and navigate to http://127.0.0.1:5000/
3. Upload your CSV files:
- Click on the "Choose Files" button to select multiple financial data files (CSV format). Sample files provided.
- Click "Upload" to submit the files.
4. View the Results:
- The app will process the uploaded files, clean the data, and generate a tax/financial scenario.
- The cleaned data and the generated scenario will be displayed on the screen.
How It Works
1. File Upload:
- The user uploads one or more CSV files containing financial data.
- The files are saved to a specified directory (uploads).
2. Data Processing:
- The uploaded files are read into Pandas DataFrames.
- Non-ASCII characters are removed from the data for better processing.
3. Scenario Generation:
- The cleaned financial data is sent to OpenAI's API with a specific prompt.
- The API generates a customized scenario that reflects potential tax/financial impacts on the business.
4. Result Display:
- The cleaned data and the generated scenario are returned and displayed in the web interface.
Contributing
All contributions are welcome!
Acknowledgments
OpenAI for providing the API to generate scenarios. Flask for making it easy to build web applications. Pandas for powerful data manipulation capabilities.
