This project is a web application that generates a story based on a provided plot using OpenAI's ChatGPT and DALL-E models. The resulting story is then illustrated and presented in an interactive web page.
- Accepts a plot as input and generates a corresponding story
- Illustrates the story with images generated using DALL-E
- Displays the story in an interactive web page
- Allows the user to download the story as a JSON file or a PDF document
- Provides the option to import a previously saved story as a JSON file
- Python 3.7 or later
- Flask
- XHTML2PDF
- OpenAI API key
-
Clone the repository and install the required dependencies
git clone https://github.com/user/story-generator.git cd story-generator pip install -r requirements.txt
-
Set up your OpenAI API key as an environment variable
export OPENAI_API_KEY=your_api_key
-
Run the app using python app_runner.py
-
The app will be served at http://localhost:5000
-
On the home page, enter a plot and submit it to generate a story
-
The resulting story will be displayed on the page, with options to download it as a JSON file or a PDF document, or to import a previously saved story as a JSON file
This repository contains a Dockerfile for building a Docker image for the openai-storyteller web app. The image is based on Python 3.8 and includes all the necessary dependencies for the app to run.
How to use:
-
Clone the repository and build the Docker image
git clone https://github.com/user/openai-storyteller.git cd openai-storyteller docker build -t openai-storyteller .
-
Run the Docker container, replacing your_api_key with your own OpenAI API key
docker run -p 5000:5000 -e OPENAI_API_KEY=your_api_key openai-storyteller
app_runner.py
: the main script to run the appsrc/sanitize.py
: a module to sanitize user inputsrc/story_generator.py
: a module to generate the story and illustrate it using the OpenAI modelssrc/openai_stories.py
: a module to interact with OpenAI from the lense of storytellingtemplates/
: a directory containing the HTML templates for the web pages
- OpenAI's ChatGPT and DALL-E models: https://openai.com/
- Flask: https://flask.palletsprojects.com/
- XHTML2PDF: https://xhtml2pdf.readthedocs.io/