A simple Python script that generates blog paragraphs on any topic using OpenAI's GPT-3.5-turbo-instruct model.
This project uses the OpenAI API to generate blog paragraphs based on user input topics. It securely loads the API key from a .env file and provides an interactive command-line interface to create dynamic content.
Generate blog paragraphs on any user-defined topic.
Interactive command-line prompts for continuous writing.
Secure loading of API key from .env file.
Lightweight and easy to set up.
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name
-
Create and Activate Virtual Enviroment On macOS/Linux: python3 -m venv .venv source .venv/bin/activate On Windows: python -m venv .venv ..venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Create a .env file in the project root with your OpenAI API key:
API_KEY=your_openai_api_key_here
Run The Script with:
python main.py
Follow the prompts to input your blog topic and continue generating paragraphs interactively.
This script uses OpenAI Python SDK version 0.28 to maintain compatibility with the current code syntax.
To upgrade to newer SDK versions, code modifications are required.