Before you start, ensure you have the following set up in your development environment:
- Python Version: Make sure Python is installed on your machine. Python 3.6 or newer is recommended.
For Windows users:
python -m venv venv
venv\Scripts\activate
For macOS and Linux users:
python3 -m venv venv
source venv/bin/activate
Install Gradio, dotenv, and the OpenAI Python client using pip:
pip install gradio python-dotenv openai
In your project's root directory, create a file named .env
. Inside this file, you will add your OpenAI API key to
ensure secure access. Insert the following line in your .env
file:
OPENAI_API_KEY=your_openai_api_key_here
python app.py