An automated tool that extracts text from PDF documents and generates concise summaries using the OpenAI API and LangChain.
- PDF text extraction: Extract text content from PDF documents.
- AI-powered summarization: Generate concise summaries of long documents.
- User-friendly interface: Simple web interface for uploading PDFs and viewing summaries.
- Handles long documents: Efficiently processes and summarizes lengthy documents.
pdf-summarizer/
│
├── app.py # Main application file with Gradio interface
├── pdf_extractor.py # Module for extracting text from PDFs
├── summarizer.py # Module for summarizing text using OpenAI API
├── .env # Environment variables file (create from .env.template)
├── .env.template # Template for environment variables
├── requirements.txt # Python dependencies
└── README.md # Project documentation
- Python 3.8 or higher
- OpenAI API key
-
Clone this repository or download the source code.
-
Create and activate a virtual environment:
python -m venv pdf_summarizer_env
source pdf_summarizer_env/bin/activate # On Windows: pdf_summarizer_env\Scripts\activate- Install the required packages:
pip install -r requirements.txt- Set up your environment variables:
cp .env.template .envThen edit the .env file and add your OpenAI API key.
- Start the application:
python3 app.py-
Open the provided URL in your web browser.
-
Upload a PDF document, and click "Process PDF".
-
View the extracted text and the generated summary.
- To change the OpenAI model, modify the
model_nameparameter in theTextSummarizerclass. - Adjust summary length and style by modifying the prompt template in the
summarize_textmethod. - For better handling of specialized documents, you can extend the extraction and chunking functions.
- The tool may not correctly process PDFs with complex layouts or heavily image-based content.
- Summarization quality depends on the OpenAI model used and the clarity of the original text.
- Processing very large documents (100+ pages) may take significant time and API tokens.
This project is licensed under the MIT License.