A newer version of the Gradio SDK is available:
6.5.1
metadata
title: PDF Analysis & Orchestrator
emoji: π
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: mit
short_description: AI-powered PDF analysis with advanced features
π PDF Analysis & Orchestrator
A powerful, intelligent PDF analysis tool that provides comprehensive document processing through AI-powered agents. This application offers advanced features including document chunking, caching, streaming responses, batch processing, and custom prompt management.
π Features
Core Analysis
- AI-Powered Analysis: GPT-4 powered document analysis with context-aware responses
- Audience Adaptation: Automatically adapts explanations for different audiences
- Document Segmentation: Identifies and segments documents by themes and topics
- Multi-Agent Orchestration: Specialized AI agents for different analysis aspects
Performance Optimizations
- Document Chunking: Smart processing of large documents (>15k chars) with sentence boundary detection
- Caching System: PDF text extraction caching for improved performance
- Streaming Responses: Real-time progress updates and status indicators
- Configurable Parameters: Adjustable chunk sizes and processing options
Enhanced Features
- Batch Processing: Handle multiple PDFs simultaneously with comprehensive reporting
- Result Export: Export analysis results in TXT, JSON, and PDF formats
- Custom Prompts: Save, manage, and reuse custom analysis prompts
- Progress Indicators: Real-time feedback during long-running analyses
- Session Management: Per-user session isolation with persistent storage
π― Use Cases
- Document Summarization: Create concise summaries of complex documents
- Technical Explanation: Explain technical content for general audiences
- Executive Summaries: Generate high-level overviews for decision makers
- Content Analysis: Extract key findings and insights from documents
- Batch Processing: Analyze multiple documents with consistent instructions
- Research Assistance: Process and analyze research papers and reports
π οΈ Setup
Prerequisites
- Python 3.10+
- OpenAI API key
Installation
Clone the repository:
git clone https://huggingface.co/spaces/your-username/pdf-analysis-orchestrator cd pdf-analysis-orchestratorInstall dependencies:
pip install -r requirements.txtSet up environment variables:
export OPENAI_API_KEY="sk-your-api-key-here"Run the application:
python app.py
π Usage
Single Document Analysis
- Upload a PDF document
- Enter your analysis instructions
- Choose analysis options (streaming, chunk size)
- Click "Analyze & Orchestrate"
- View results and export if needed
Batch Processing
- Upload multiple PDF files
- Enter batch analysis instructions
- Click "Process Batch"
- Review comprehensive batch results
Custom Prompts
- Go to "Manage Prompts" tab
- Create custom prompt templates
- Organize by categories
- Reuse prompts across analyses
ποΈ Architecture
Core Components
- AnalysisAgent: Primary analysis engine using GPT-4
- CollaborationAgent: Provides reviewer-style feedback
- ConversationAgent: Handles user interaction
- MasterOrchestrator: Coordinates agent interactions
Key Files
app.py: Main application with Gradio interfaceagents.py: AI agent implementations with streaming supportconfig.py: Centralized configuration managementutils/: Utility functions for PDF processing, caching, and export
π§ Configuration
Environment Variables
OPENAI_API_KEY: Required OpenAI API keyOPENAI_MODEL: Model to use (default: gpt-4)CHUNK_SIZE: Document chunk size (default: 15000)CACHE_ENABLED: Enable caching (default: true)ANALYSIS_MAX_UPLOAD_MB: Max upload size in MB (default: 50)
Model Configuration
- Temperature: 0.2 (consistent, focused responses)
- Max tokens: 1000 (concise but comprehensive)
- System prompts: Designed for high-quality output
π Performance
- Response Time: Typically 2-5 seconds for analysis
- File Size Limit: 50MB (configurable)
- Concurrent Users: Supports multiple simultaneous sessions
- Memory Usage: Optimized for efficient processing
- Caching: Reduces processing time for repeated documents
π Security
- File size validation
- Session isolation
- Secure file handling
- No persistent storage of sensitive data
- Environment-based configuration
π€ Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Built on the successful Analysis & Orchestrate feature from Sharmaji ka PDF Blaster V1
- Powered by OpenAI's GPT-4 model
- UI framework: Gradio
- PDF processing: pdfplumber
π Support
For issues and questions:
- Check the documentation
- Review existing issues
- Create a new issue with detailed information
Note: This project focuses exclusively on the Analysis & Orchestrate functionality, providing the same high-quality results in a streamlined, focused package with enhanced performance and user experience.