/pdf-to-audiobook

A python script that generates a short story and saves it in PDF format, before rendering an audio version and saving it as an MP3 file.

Primary LanguagePythonMIT LicenseMIT

PDF to Audiobook

PDF to Audiobook

Table of Contents

Introduction

This Python script empowers you to transform short stories into engaging audiobooks effortlessly. Leveraging the capabilities of OpenAI's GPT-3 and TTS-1 models, the converter not only generates captivating short stories but also converts them into beautifully formatted PDFs and narrates them in audio format.

Prerequisites

  • OpenAI API Key
  • Python 3 installed on your system

Setup

Follow these simple steps to set up and run the PDF to Audiobook Convertor:

  1. Clone the Repository
    git clone https://github.com/your-username/pdf-to-audiobook.git
    
  2. Navigate to the Project Directory:
    cd pdf-to-audiobook
    
  3. Install Required Packages:
    pip install -r requirements.txt
    
  4. Set OpenAI API Key:
    export OPENAI_API_KEY="your-api-key"
    

Usage

Running the script is straighforward. Follow these steps:

  1. Execute the main script:
    python main.py
    
  2. Respond to the prompt:
    • To generate a new story, PDF, and audiobook, type "Y".
    • To convert an existing PDF to an audiobook, type "N" and provide the PDF filename.

Output

  • PDF: The generated PDF is saved in the output/ directory.
  • Audiobook (MP3): The audio rendition is saved in the output/ directory.

Notes

  • The generated story is limited to 4000 characters.
  • Ensure the input PDF is in the root directory and spelled correctly.

Contributing

Currently, contributions are not accepted for this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.