Skip to main content

A Python library for drawing

Project description

Drawbook

drawbook is a Python library that helps you create illustrated children's books using AI. It leverages image generation AI models to generate watercolor-style illustrations corresponding to text that you have written and then exports them to a PowerPoint / Slides file that you can further edit.

Features

  • AI-Generated Illustrations: Automatically create watercolor illustrations based on the text you provide.
  • Create Illustrations Programmatically or with a User-Firendly UI: Create illustrations with a single line of Python -- book.illustrate() --, or a open up a Gradio UI in your browser -- book.preview() -- to have more fine-grained control over the illustrations.
  • Start Quickly, Refine Later: Export your illustrations a presentation (PowerPoint/Google Slides) that serves as a starting point - you can then change the layouts, images, and text to perfect your final design.

Installation

To install Drawbook, use pip:

pip install drawbook

Usage

Here’s how you can create an illustrated book using Drawbook in a few lines of Python:

from drawbook import Book

book = Book(title="Mustafa's Trip to Mars", pages=[
    "One day, Mustafa climbs into the attic and finds a white spacesuit.",
    "He puts on the spacesuit and the spacesuit starts to glow!",
    "Mustafa starts to float up into the air in his spacesuit. He waves bye-bye to his house as it gets tiny down below.",
    "The stars look like tiny lights all around him. His spacesuit flies fast past the moon and the sun.",
    "Mustafa lands on Mars. The landing makes a big crater in the Martian surface.",
    "Mustafa explores Mars in his spacesuit. He meets a Martian and waves hello to him.",
    "Mustafa and the Martian play with toys on Mars. They have a great time together!",
], author="Abubakar Abid")

book.illustrate()  # Generates illustrations for every page

book.export("Mustafas_Trip_To_Mars.pptx")

When you run the code above, Drawbook will generate a PowerPoint file (Mustafas_Trip_To_Mars.pptx) that contains:

  • Text content formatted across multiple slides.
  • AI-generated watercolor illustrations that match the content of each page.

Preview & Refine

If you'd like to regenerate the illustrations on any specific page, simply run:

book.preview()

This will launch a Gradio demo that lets you see the prompt used to create each illustration. You can edit the prompt and keep re-generating images until you have a great series of illustrations for your book. Once you're down, just click "Export" and then "Download" to get your exported slides.

Contributing

Contributions to drawbook are welcome! If you have ideas for new features or improvements, feel free to submit an issue or pull request on the GitHub repository.

License

Drawbook is open-source software licensed under 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

drawbook-0.2.0.tar.gz (6.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drawbook-0.2.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file drawbook-0.2.0.tar.gz.

File metadata

  • Download URL: drawbook-0.2.0.tar.gz
  • Upload date:
  • Size: 6.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for drawbook-0.2.0.tar.gz
Algorithm Hash digest
SHA256 25868fe85107d439f3733e05e351bccbad87062f922d4a5b3584b07de7a03284
MD5 a3ac862e5b46ecb602e4915159694868
BLAKE2b-256 8d0daaae099d1a6c58cb7d60a888513f743420fc1e7ec969f5073a6771b42510

See more details on using hashes here.

File details

Details for the file drawbook-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: drawbook-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for drawbook-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b3c68297df459bc671c61527fcce8b50a2a6a487226f13c58e8186ff233ec7e
MD5 6b444c5c3db8d9a105c20de51908de20
BLAKE2b-256 c31b957acd594b078a0778b8ec3e9380356ff36836ff4ec2d2e2d955f970992a

See more details on using hashes here.

Supported by

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