ai-childrens-books is a tool that uses GPT-3 to generate ideas and text for children's books.
To install ai-childrens-books, clone the repository and install the dependencies:
git clone https://github.com/supervised/ai-childrens-books.git
cd ai-childrens-books
pip install -r requirements.txt
You will also need to obtain an API key for the OpenAI GPT-3 library.
To use ai-childrens-books, import the book
module and call the ideas
and/or write
functions:
import book
# Generate ideas for a children's book about unicorns
book.ideas(concept="unicorns", age=5, save="unicorn_ideas.txt")
# Generate text for a children's book about unicorns
book.write(concept="unicorns", age=5, save="unicorn_book.txt")
The ideas function generates ideas for a children's book from the concept input. The write function generates the text for a children's book from the concept input. The age option specifies the age of the reader. The save option is optional, and allows the user to save the output to a file. The other options are used by GPT-3 to control the generation.
The ideas
and write
functions accept the following options:
concept
(required): The concept for the children's book.age
: The age of the intended reader.temperature
: The temperature to use for sampling. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer.max_tokens
: The maximum number of tokens (words and word pieces) to generate in the prompt.top_p
: Controls the proportion of the mass of the distribution to be included in the top_p mass of the sorted list of candidates. If top_p is 1, then the model will always select the most likely token. If top_p < 1, then the model will consider a subset of the sorted list.frequency_penalty
: Controls the relative importance of frequency of appearance and novelty. If frequency_penalty is 0, then the model will prefer novel tokens. If frequency_penalty is > 0, then the model will penalize novel tokens.presence_penalty
: Controls the relative importance of presence in the prompt and absence. If presence_penalty is 0, then the model will prefer tokens that are not present in the prompt. If presence_penalty is > 0, then the model will penalize tokens that are not present in the prompt.best_of
: The number of top candidates to consider for each token. Higher values means slower decoding and higher quality.save (optional)
: The name of the file to save the output to. If not provided, the output will be printed to the console.
ai-childrens-books is a tool that uses the OpenAI GPT-3 library, which is a machine learning model trained on a large dataset of internet text. The output generated by ai-childrens-books is not guaranteed to be appropriate or accurate, and is intended for entertainment purposes only. Use of ai-childrens-books is at the user's own risk. OpenAI and the developers of ai-childrens-books are not responsible for any damages or losses that may result from use of the tool. By using ai-childrens-books, the user acknowledges and agrees to these terms.