diff --git a/notebooks/gptauthor_colab_custom_story.ipynb b/notebooks/gptauthor_colab_custom_story.ipynb new file mode 100644 index 0000000..8ea4c75 --- /dev/null +++ b/notebooks/gptauthor_colab_custom_story.ipynb @@ -0,0 +1,353 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "JarYwM4FxV5x" + }, + "source": [ + "# GPT Author Demo - with customisable story prompt\n", + "\n", + "[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/dylanhogg/gptauthor/blob/master/notebooks/gptauthor_colab_custom_story.ipynb)\n", + "\n", + "Unleash your storytelling genius: GPT Author is an easy to use command-line tool for writing long form, multi-chapter stories given a story prompt.\n", + "\n", + "https://github.com/dylanhogg/gptauthor\n", + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "duxRkvbeKbH4" + }, + "source": [ + "This notebook demonstrate GPT Author with these steps:\n", + "1. Install gptauthor\n", + "2. **Customise your own story!** Edit the story prompt with any plot, style and characters you want to create\n", + "3. Ask you for your OpenAI API Key (hidden in UI using getpass) to set as an environment variable\n", + "4. Run gptauthor\n", + "5. Find the book output html file on the colab filesystem\n", + "6. Display the book" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ZsrezNA9LppM" + }, + "source": [ + "## Install gptauthor" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Og6vjqOqxO9X", + "outputId": "5413e526-552f-4801-e360-71c5c8e41aa9" + }, + "outputs": [], + "source": [ + "# Install gptauthor from pypi (https://pypi.org/project/gptauthor/)\n", + "# (Ignore any dependency resolver issues, they're fine)\n", + "%pip install gptauthor -q" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "_dwPBofNxP0z", + "outputId": "e9561844-acde-4f12-965f-f32905336806" + }, + "outputs": [], + "source": [ + "# Display installed gptauthor version\n", + "%pip list | grep gptauthor" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Z8JQTYP2W0BJ" + }, + "source": [ + "## Customise and describe your story in the story prompt yaml\n", + "\n", + "You can customise your own story! Edit the story prompt with any plot, style and characters you want to create.\n", + "\n", + "Keep the top level names as they are and edit the contents of both the \"common-book-description\" and \"common-book-characters\" sections. Run the cell and write the string to your custom file for GPT Author to read and expand on." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "GCXR94dpUUwm" + }, + "outputs": [], + "source": [ + "story_prompt_yaml = \"\"\"\n", + "common-book-description: |-\n", + " Style of the engaging, witty and funny book:\n", + " The book has storytelling style similar to Douglas Adams or PG Wodehouse to create an engaging, witty and funny story.\n", + " These storytelling devices include jokes, satire, wit, and surprise endings.\n", + " The character scenes, timelines, and how they get between locations is considered and explained during the story telling.\n", + " Ensure you are clear about why each action and plot point is happening - no need to tell the reader the why's, but you need to know yourself to weave a good story.\n", + " There is no need to include a moral or lesson in the story, but it should be fun and engaging for the reader.\n", + " Each character is engaging and believable. Include a description of each character, including their appearance, personality, and any quirks.\n", + " There is lots of interesting dialog that helps to develop the characters and the plot.\n", + " You must not end a chapter with any variation of 'To be continued...'.\n", + "\n", + " Key points of the story:\n", + " You are a cutting edge developer, using Google Colab at every opportunity.\n", + " Your current research is to run \"GPT Author\", an AI tool that automatically writes compelling stories given a story prompt.\n", + " You have the demo notebook open and are swiftly running each cell with enjoyment and glee!\n", + " All is going very well until you realise you are actually just a character within the story prompt and that running the \"GPT Author\" tool will dictate the fate of the rest of your life...\n", + " The final chapter has a twist that is unexpected and unnerving.\n", + "\n", + "common-book-characters: |-\n", + " Here is some background on the main characters of the story:\n", + " Joe Hacker: a developer and main character\n", + " \"GPT Author\": a semi-sentient AI solftware tool\n", + " Morpheus: A real person who has escaped from the fictional Matrix movie franchise\n", + "\n", + "synopsis:\n", + " system: You are a clever and creative story book author. You are skilled at weaving stories that are coherent, and fun to read. You are skilled at creating characters that are engaging and believable.\n", + " prompt: |-\n", + " Write {total_chapters} chapter outlines of a story book.\n", + "\n", + " {book_description}\n", + "\n", + " {book_characters}\n", + "\n", + " The final chapter has a twist that is unexpected and unnerving.\n", + "\n", + " First, give the title of the book.\n", + " Then give each of the {total_chapters} chapters an outline, in the format \"Chapter N: