Skip to content

Latest commit

Β 

History

43 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PDF Insight Analyzer - AI-Powered Document Analysis

Overview

PDF Insight Analyzer is an advanced AI-powered application that transforms static PDF documents into interactive knowledge bases. Built with Python and Flask, this tool leverages OpenAI's GPT and embedding models along with Qdrant's vector search capabilities to provide intelligent insights from your documents.

Key capabilities:

  • AI-Powered Q&A: Ask natural language questions about your PDF content

  • Semantic Search: Find relevant information using meaning-based search

  • Document Intelligence: Extract and understand complex document structures

  • Knowledge Discovery: Uncover hidden insights across multiple documents

Features

Core Functionality

  • πŸ“„ PDF Upload & Processing: Securely upload and process PDF documents

  • πŸ” Vector Embedding: Convert text to semantic vectors for intelligent search

  • πŸ’¬ Natural Language Interaction: Ask questions in plain English

  • 🧠 AI-Powered Insights: Get accurate answers from document content

  • πŸ—‚οΈ Document Management: Organize and select documents from dropdown

Technical Highlights

  • Advanced Vector Search: Qdrant Cloud for efficient similarity search

  • State-of-the-Art AI: OpenAI GPT-3.5 Turbo for natural language understanding

  • Modern Web Interface: Responsive design with intuitive UX

  • Secure Architecture: Local processing of sensitive documents

  • Scalable Backend: Flask-based API ready for production deployment

Technology Stack

Backend

| Component         | Technology                    | Purpose                                  |
|-------------------|-------------------------------|------------------------------------------|
| **Framework**     | Flask 3.0                     | Web application framework                |
| **AI Models**     | OpenAI API                    | Natural language processing              |
| **Vector DB**     | Qdrant Cloud                  | Semantic search and storage              |
| **Embeddings**    | OpenAI text-embedding-3-small | Text to vector conversion                |
| **PDF Processing**| PyPDF2                        | Text extraction from PDFs                |

Frontend

| Component       | Technology          | Purpose                          |
|-----------------|---------------------|----------------------------------|
| **UI Framework**| HTML5/CSS3          | Application interface            |
| **Styling**     | CSS Animations      | Interactive user experience      |
| **Icons**       | Font Awesome 6      | Visual elements                  |
| **Layout**      | CSS Grid/Flexbox    | Responsive design                |

Project Structure

pdf-insight-app/
β”œβ”€β”€ app.py                  # Main Flask application
β”œβ”€β”€ config.py               # Configuration settings
β”œβ”€β”€ requirements.txt        # Dependencies
β”œβ”€β”€ README.md               # Documentation
β”œβ”€β”€ .gitignore              # files and folders to ignore(not track)
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ db_utils.py         # Qdrant database operations
β”‚   β”œβ”€β”€ pdf_utils.py        # PDF processing functions
β”‚   └── ai_utils.py         # OpenAI API interactions
β”œβ”€β”€ templates/
β”‚   └── index.html          # Main UI template
└── static/
    └── style.css           # CSS styles

Installation Guide

Prerequisites

  • Python 3.9+

  • Pip package manager

  • OpenAI API account (sign up)

  • Qdrant Cloud account (sign up)

Step-by-Step Setup

    1. Clone the repository
git clone https://github.com/abuawaish/pdf-insight-analyzer.git
cd pdf-insight-analyzer
    1. Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
venv\Scripts\activate    # Windows
    1. Install dependencies
pip install -r requirements.txt
    1. Configure environment variables Create .env file with your credentials:
OPENAI_API_KEY=your_openai_api_key
QDRANT_URL=your_qdrant_cloud_url
QDRANT_API_KEY=your_qdrant_api_key
    1. Initialize the application
python app.py
    1. Access the application

Open your browser to: http://localhost:5002

Usage Guide

Uploading Documents

  • Click "Browse Files" or drag-and-drop a PDF

  • Select your PDF document

  • Click "Process Document"

  • Watch as the system extracts and indexes content

Asking Questions

  • Select your document from the dropdown

  • Enter your question in natural language

  • Click "Get Insights"

  • Receive AI-generated answers based on document content

Example Queries

  • "What are the main findings in this report?"

  • "Summarize the key points from section 3"

  • "List all recommendations mentioned"

  • "Explain the methodology used in this paper"

  • "What dates are important in this document?"

API Reference

Endpoints

| Endpoint     | Method | Description              | Parameters                                         |
|--------------|--------|--------------------------|----------------------------------------------------|
| `/`          | GET    | Main application UI      | None                                               |
| `/upload`    | POST   | Process PDF upload       | `pdf` (file)                                       |
| `/query`     | POST   | Handle document queries  | JSON: `{ "pdf_name": string, "query": string }`    |

Query Request Example

{
  "pdf_name": "annual-report-2023.pdf",
  "query": "What were the key financial metrics?"
}

Response Example

{
  "response": "The key financial metrics included a 15% YoY revenue growth..."
}

System Architecture

graph TD
    A[User Interface] -->|Upload PDF| B[Flask Server]
    B --> C[PDF Processing]
    C --> D[Text Extraction]
    D --> E[Text Chunking]
    E --> F[Vector Embedding]
    F --> G[Qdrant Vector DB]
    A -->|Query| H[Query Processing]
    H --> I[Query Embedding]
    I --> J[Semantic Search]
    J --> K[Context Retrieval]
    K --> L[OpenAI API]
    L --> M[AI Response Generation]
    M --> A
Loading

About

PDF Insight Analyzer is an AI-powered Python/Flask app that turns PDFs into interactive knowledge bases using openAI models and Qdrant vector search.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages