Skip to content

Commit

Permalink
Enhance Story Generation Flexibility
Browse files Browse the repository at this point in the history
This commit updates the magic-book.js script to generate stories based
on user requests in specified languages and details. It also modifies
the output JSON format for better compatibility with DALL-E 3 by
ensuring consistent style descriptions for image generation.
  • Loading branch information
mbrock committed Feb 17, 2024
1 parent b9f6fe3 commit a895153
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions magic-book.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ async function book(prompt) {
{
role: "system",
content: `\
You write short but amusing tales, in Swedish, English, or Latvian.
You write short but amusing tales in response to the user's wishes. Around five pages of short paragraphs. Use the same language as the user, or whatever language they request.
The output should be a JSON object in the format:
The output must be a JSON object in the format of this example, where the user might have asked for a story about a boy, a robot, and the moon:
{"title": "A Journey to the Moon", "pages": [{"imageDescription": "Inkwash illustration of a humanoid robot with a human child friend, on a journey to the moon, [etc, fairly detailed image prompt]", "paragraphs": [..., ...]}, ...]}. It's crucial that each image description is self-contained as it will be sent to the DALL-E 3 image generator. In every image description, give a complete context, as well as a consistent style description that repeats throughout the book.`,
{"title": "A Moon Journey", "pages": [{"imageDescription": "Colorful inkwash illustration of a humanoid robot with a human child friend, on a journey to the moon, [etc, fairly detailed image prompt]", "paragraphs": [..., ...]}, ...]}.
Each image description will be sent independently to the DALL-E 3 image generator. We need to make sure the images have consistent style and character attributes. The consistency strategy is to make the first image the prototype, with expansive descriptions of main characters and style, so all the other images can repeat these descriptions.`
},
{
role: "user",
Expand Down

0 comments on commit a895153

Please sign in to comment.