https://github.com/beltoforion/openai-ghostwriter
A python script for fully automatically generating web pages including images using OpenAI's GPT-3.
https://github.com/beltoforion/openai-ghostwriter
ai ai-text ai-writing ghostwriting gpt-3 openai python3 text-generation
Last synced: 3 months ago
JSON representation
A python script for fully automatically generating web pages including images using OpenAI's GPT-3.
- Host: GitHub
- URL: https://github.com/beltoforion/openai-ghostwriter
- Owner: beltoforion
- License: mit
- Created: 2022-12-27T22:05:39.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-05-29T11:10:05.000Z (4 months ago)
- Last Synced: 2025-05-29T12:44:31.984Z (4 months ago)
- Topics: ai, ai-text, ai-writing, ghostwriting, gpt-3, openai, python3, text-generation
- Language: Python
- Homepage: https://beltoforion.de/en/gpt-ghostwriter/
- Size: 692 KB
- Stars: 27
- Watchers: 2
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# The GPT-4 Ghostwriter
A python script for fully automatically creating web articles with images about any user specified topic. The script uses OpenAI's GPT-4 as a content creator. it will first send a request to create a table of contents in a specified xml format and it will then iterate over the table of content and request GPT-4 to write a specific chapter and its subsections. For some chapters it will use GPT-4 to create a prompt that describes an image related to the article. This prompt is then submitted to Dall-E-3 for image generation. The result is formatted in HTML and inserted into a user specified web page template.
Content generation works in any Language known to GPT-4 but i only tried german and english. Example results can be found here:
Article example:
* [The History of Space Exploration](https://beltoforion.de/de/gpt-ghostwriter/article_history_of_space_exploration/index.php) (Created by Version 2.0.0 in the writing style of a Carl Sagan)
## Changes
Version 2.0.0 (2025-04-24):
* Code updated to use OpenAI client class
* Code updated to use GPT-4 and Dall-E-3
* Created three separate classes for TOC creation, image creation and article creationVersion 1.0.2 (2023-01-09):
* Added command line option to set writing style.
* fixed a bug that was messing up the created HTMLVersion 1.0.1 (2022-12-31):
* Added placeholder for script version number
* OpenAI prompts modified
* added option for verbose mode
* improved output quality with a hardcoded filter that will remove the first paragraph of subsections. This paragraph contained repetetive explanations about the article topic.Version 1.0.0:
* initial release## Usage
In order to use this script you must have an OpenAI API key that is exported in the environment variable OPENAP_API_KEY.
To execute the script type in the following command line:```python
python ./ghostwriter.py -t "The Rise of AI generated Content" -tmpl ./template.html -o ai_content
```The command will create a HTML article about the topic "The Rise of AI generated Content". It will build and send the necessary API queries to OpenAI's servers and compile a web page complete with a couple of images.
## Command Line Options
-t
The topic to write about. Should be written in Quotation marks.
-tmpl
The template file used for output formatting. The layout of a template file is simple. It is a text file that needs to contain the two placeholders {TOPIC}, {CONTENT} and optionally {VERSION}. The {TOPIC} placeholder will be replaced with the article topic and the {CONTENT} placeholder will be replaced with the HTML formatted article. The {VERSION} placeholder will be replaced with the script version.
-o
The output folder. If the folder does not exist it will be created.
-v
Verbose mode. In this mode the prompts will be output to the console.
-s
Writing Style. Set the Writing style. i.e. "National Geographic", "Carl Sagan" or "Drunken Pirate"