Skip to main content

An A.I. tool for generating long Kindle ebooks based on a prompt

Project description

long_ebook_generator_ai

Overview

long_ebook_generator_ai is a Python package designed to generate a long (or short) eBook based on an AI-generated outline. It leverages AI to create structured book content with chapters, sections, and paragraphs, and can automatically create ePub files. The script can also generate a book cover image if desired. The output eBook can be used for Kindle and other eBook readers.

Features

  • Outline Generation: Automatically generate a book outline with customizable depth and structure.
  • eBook Creation: Converts the generated outline into an ePub file format.
  • Customizable Content: Allows specifying the number of chapters, sections, and paragraphs for the generated book.
  • Cover Image Generation: Option to generate a cover image based on an AI-prompt.
  • Kindle Compatibility: Ensures that the generated ePub file is compatible with Kindle devices if needed.

Usage

1. Create a Book Outline

You can generate a book outline by providing the book title and specifying the desired structure:

  • num_chapters: Number of chapters in the book.
  • sections_per_chapter: Number of sections per chapter.
  • subsections_per_section: Number of subsections within each section.
  • paras_per_subsection: Number of paragraphs per subsection.

Example:

book_writer = BookWriter("How to become a Film Producer", use_gpt4all=False, openai_api_key="your openai key here")
book_writer.generate_outline(num_chapters=3, sections_per_chapter=2, subsections_per_section=3, paras_per_subsection=3)

2. Generate the eBook

Once the outline is generated, you can create an ePub file. You have the option to generate a cover image by providing an image_prompt for AI-based image generation.

Example:

image_prompt = "Photo realistic cover of How to become a Film Producer"
book_writer.generate_ebook(author='Alexis Kirke', image_prompt=image_prompt)

3. Save the eBook

The script automatically saves the generated eBook in the current working directory with a filename based on the book title. The ePub file will be Kindle-compatible if the force_kindle_compatibility flag is set to True.

Example Workflow

if __name__ == "__main__":
    title = 'How to become a Film Producer in the age of Indies, Netflix, YouTube, and A.I.: A Step by Step Guide'
    book_writer = BookWriter(title, use_gpt4all=False, openai_api_key="your openai key here")
    book_writer.generate_outline(num_chapters=3, sections_per_chapter=2, subsections_per_section=3, paras_per_subsection=3)

    image_prompt = "Photo realistic. " + title
    book_writer.generate_ebook(author='Alexis Kirke', image_prompt=image_prompt)

Customization

Parameters

You can customize the output by modifying the following parameters during the outline and eBook generation processes:

  • title: The title of your book.
  • author: The author name to be included in the book.
  • num_chapters: Number of chapters.
  • sections_per_chapter: Number of sections per chapter.
  • subsections_per_section: Number of subsections in each section.
  • paras_per_subsection: Number of paragraphs per subsection.
  • generate_cover: Boolean to indicate whether to generate a cover image.
  • force_kindle_compatibility: Ensures the ePub file is Kindle-compatible.

License

This project is open-source. You are free to use, modify, and distribute it under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

long_ebook_generator_ai-1.0.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

long_ebook_generator_ai-1.0.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file long_ebook_generator_ai-1.0.0.tar.gz.

File metadata

File hashes

Hashes for long_ebook_generator_ai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7924c2980c95632fe8edbaf7ea9aaaf58feb8f3fc4ada873c43764753c1549cc
MD5 1547b821e34980b26d21cce6ab64a8a1
BLAKE2b-256 b65c22f4e4f5708a304c2402aee0c0c7951e88ef4324889c3a1b73fa23a074e9

See more details on using hashes here.

File details

Details for the file long_ebook_generator_ai-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for long_ebook_generator_ai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1650156df6f725bb31bfa9e7a8832a020ee7c3d220ecdba20912532d4ec9a56f
MD5 85e84173ba7ce5ff97379534e94cb16a
BLAKE2b-256 3cc8b663dd4a1d08c34f7b2f530ca24d6a2e38c00899493a1ec55b6ec791022a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page