/story-builder

create a children's book with AI

Primary LanguagePython

story-book

to run:

First, you will need to setup a Open-AI API Env var, as OPENAI_API_KEY more info here and stability api key as STABILITY_KEY more info here

pip install openai
pip install stability-sdk
py generate-book.py
cd story-book
yarn start

Just change the create_story params in generate-book.py and re-run to create a new story, eg. py generate-book.py. You can leave the webserver running. It will move copy the new run assets into the webserver directory for you, eg move ./run-name to ./story-book/src/story.

input:

run_name = 'fox-story'
pages = '6'
story_prompt = "a quick brown fox named Speedy that hops over a lazy boy named Ben. They become friends and the fox teaches the boy to be quick."
art_style = 'vintage illustration'
api = 'openai' # or it can be 'stability' (this is for the images only)
create_story(run_name, story_prompt, pages, art_style)

output:

image

image

image

image

image

image

image

input:

run_name = 'pets-queen'
story_prompt = "There is a girl named Emma who trains pets to battle against other teams of pets. She has a journey and meets and loses several pets. She wants to battle the pets prince and win the pets tournament. She struggles but learns that her love and friendship for her pets is what she needs to defeat the Pets Prince. She defeats the pets prince and her and her pets live happy ever after."
pages = '6'
art_style = 'art nouveau'

create_story(run_name, story_prompt, pages, art_style)

output: image

image

image

image

image

image

image

example of logs:

Emma, Pets Prince, and the pets Emma trains.


Once upon a time, there was a young girl named Emma. Emma had a dream of training pets to battle against other teams of pets. She had a deep love for animals and was determined to turn her dream into a reality.

One day, Emma set out on a journey to make her dream come true. Along the way, she encountered many different pets and befriended them all. As Emma trained each pet, she grew closer to them and formed strong bonds of friendship.

As Emma continued on her journey, she encountered several obstacles. She faced tough opponents, lost some of her beloved pets, and had to make tough decisions. Emma was determined not to give up and kept pushing forward, determined to beat the pets prince and win the tournament.
the tournament.

Emma was elated and all of her pets were overjoyed as well. Emma learned that her love and friendship for her pets was what she needed to defeat the Pets Prince. She was so proud of her journey and of her beloved pets.

Emma and her pets lived happily ever after, never forgetting the lessons they learned together. Emma was thankful for the journey and the bonds she shared with her furry friends.


"The Pawsitive Journey of Emma and Her Friends"


This is an image of a group of four friends, all of whom are animals. The main character, Emma, is a small white and brown dog with a pink bow in her hair. She is standing in the center of the group, surrounded by her three friends. To her left is a large, fluffy white cat with a pink bow in her hair. To her right is a small


The image shows a young girl with long brown hair, wearing a bright yellow t-shirt and blue jeans, standing in a grassy field with a group of animals around her. She has a determined look on her face and is holding a leash in one hand and a whistle in the other. The animals around her include a dog, a cat, a rabbit, a bird, and a


In the image, Emma is standing in a lush green meadow with a variety of animals surrounding her. She is wearing a bright yellow dress and a wide-brimmed hat, and she has a smile on her face. The animals around her include a dog, a cat, a rabbit, a bird, and a horse. They are all looking up at Emma with adoration,


The image shows Emma standing in the middle of a large arena, surrounded by a cheering crowd. She is wearing a determined expression and her fists are clenched. She is surrounded by a variety of opponents, some of them towering over her. In the background, there are several of her beloved pets, some of them looking sad and defeated. In the distance, the silhouette of the prince can be


The image shows Emma standing in the middle of a large arena, surrounded by cheering spectators. She is wearing a bright blue dress and a determined expression on her face. Her two pets, a dog and a cat, are standing beside her, looking proud and excited. In the background, the prince of the tournament can be seen, looking defeated and dejected. The sun is shining brightly,


In the image, Emma is standing in the middle of a room surrounded by her pets. She is beaming with joy and pride, her arms outstretched as if to embrace them all. Her pets are all around her, jumping and barking with excitement. They are all wearing colorful collars and ribbons, and some of them are even wearing crowns. The walls of the room are


The image is of a young girl, Emma, sitting in a grassy field with her two pets, a dog and a cat, snuggled up close to her. Emma is smiling and her eyes are closed, as if she is savoring the moment. The sun is setting in the background, casting a warm, golden light over the scene. The dog and cat are both looking