This application allows you to upload PDF documents, analyze their content using embeddings, and ask questions about the text. It combines document analysis with a research assistant to help you extract information and insights from your documents.
- PDF Upload & Processing: Upload any PDF document and process it for analysis.
- Document Summarization: Automatically generate a comprehensive summary of the uploaded document.
- Question & Answer: Ask specific questions about the document content and get accurate answers.
- Semantic Search: Search for specific information within the document using natural language queries.
- Document Metadata: View basic metadata about your document such as page count and word count.
- Vector Store Management: Efficiently store and retrieve document embeddings for fast retrieval.
- Streamlit: For the web interface
- LangChain: For document processing and conversational chains
- OpenAI: For embeddings and language model
- FAISS: For vector storage and similarity search
- PyPDF: For PDF document handling
- Python 3.8 or higher
- OpenAI API key
-
Clone this repository:
git clone https://github.com/yourusername/pdf-analyzer.git cd pdf-analyzer -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install the required packages:
pip install -r requirements.txt -
Create a
.envfile in the root directory with your OpenAI API key:OPENAI_API_KEY=your_api_key_hereAlternatively, you can enter your API key in the application's sidebar.
Start the Streamlit application:
streamlit run app.py
The application will be available at http://localhost:8501 in your web browser.
- Enter your OpenAI API key in the sidebar (if not set in the
.envfile). - Upload a PDF document using the file uploader.
- Wait for the document to be processed and the summary to be generated.
- Ask questions about the document in the question input field.
- Use the semantic search feature to find specific information in the document.
- Adjust chunk size and overlap in the sidebar to optimize for different types of documents.
- Choose between different OpenAI models for different performance and cost trade-offs.
- The application is designed for text-based PDFs. Scanned documents or PDFs with complex layouts may not work well without OCR preprocessing.
- Processing very large documents may take some time and consume more API usage.
- The quality of answers depends on the quality of the document and the language model being used.
- Support for more document types (DOCX, TXT, etc.)
- Multi-document analysis and cross-referencing
- Document comparison features
- Advanced visualization of document topics and concepts
- Integration with web search for supplementary information