Skip to content

Latest commit

 

History

History
72 lines (43 loc) · 1.72 KB

README.md

File metadata and controls

72 lines (43 loc) · 1.72 KB

EPUB Summarizer

This repository provides tools to convert EPUB files into Markdown format and then summarize them using LLMs.

Features

  • Convert EPUB to Markdown: Extracts text from an EPUB file and converts it to Markdown format.
  • List Chapters in Markdown: Lists all chapters from the Markdown file.
  • Summarize Markdown: Summarizes the content of a Markdown file, breaking it down into chapters, and generates concise summaries using GPT-based models.

Prerequisites

1. Install Dependencies

Install the required Python packages using pip:

pip install -r requirements.txt

2. Set the env variables

Create an .env file in the root of the project directory with your OpenAI API key and model:

OPENAI_API_KEY=your_openai_api_key_here
MODEL=gpt-4o-mini

Usage

1. Convert an EPUB File to Markdown

Use the convert.py script to convert an EPUB file to Markdown format:

python convert.py /path/to/your.epub

2. List Chapters in a Markdown File

Use the markdown.py script to list all chapters in the Markdown file:

python markdown.py --chapters /path/to/your_markdown.md

3. Summarize the Markdown File

Summarize All Chapters

You can summarize all chapters interactively using the following command:

python markdown.py --summarize /path/to/your_markdown.md

The script will ask for confirmation before summarizing each chapter.

Summarize a Specific Chapter

To summarize a specific chapter, use the --chapter flag:

python markdown.py --summarize /path/to/your_markdown.md --chapter 1

4. Modify the Summarization Prompt

You can customize the prompt used for summarization by editing the prompt.txt file.