Skip to content

Latest commit

 

History

History
156 lines (121 loc) · 3.77 KB

File metadata and controls

156 lines (121 loc) · 3.77 KB

Setup Instructions

Quick Start

  1. Create and activate virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  2. Install system dependencies (macOS):

    brew install libmagic
  3. Install Python dependencies:

    pip install -r requirements.txt
  4. Set up environment variables:

    cp env_example.txt .env
    # Edit .env with your API keys
  5. Test the setup:

    python test_setup.py
  6. Run the tool:

    python main.py --info
    python main.py sample_file.pdf

API Keys Setup

OpenAI API Key

  1. Go to OpenAI API
  2. Create an account and generate an API key
  3. Add to .env file: OPENAI_API_KEY=your_key_here

Google Gemini API Key

  1. Go to Google AI Studio
  2. Create a project and generate an API key
  3. Add to .env file: GOOGLE_API_KEY=your_key_here

System Dependencies

macOS

# Required for file type detection
brew install libmagic

# Optional: For video/audio processing (if you encounter issues)
brew install ffmpeg

Linux (Ubuntu/Debian)

# Required for file type detection
sudo apt-get install libmagic1

# Optional: For video/audio processing
sudo apt-get install ffmpeg

Windows

# Install libmagic through conda or pip
pip install python-magic-bin

# FFmpeg can be installed from https://ffmpeg.org/download.html

Troubleshooting

Common Issues

  1. "No module named 'pyaudioop'" warning

    • This is a Python 3.13+ compatibility issue with some audio libraries
    • The tool will still work for document processing
    • Audio/video features may have limited functionality
    • Consider using Python 3.11 or 3.12 if you need full multimedia support
  2. "MoviePy not available" warning

    • This affects video processing capabilities
    • Document processing (PDF, Word, Excel) still works perfectly
    • For video support, try: pip install --force-reinstall moviepy
  3. "failed to find libmagic" error

    • Install libmagic system library: brew install libmagic (macOS)
    • On Linux: sudo apt-get install libmagic1
    • On Windows: pip install python-magic-bin
  4. API errors

    • Verify your API keys are correct in the .env file
    • Check that your OpenAI/Google accounts have sufficient credits
    • Ensure the .env file is in the project root directory

Testing Individual Components

Test only OpenAI processor (documents):

python -c "from src.file_processors.openai_processor import OpenAIProcessor; print('OpenAI OK')"

Test only Gemini processor (multimedia):

python -c "from src.file_processors.gemini_processor import GeminiProcessor; print('Gemini OK')"

Minimal Installation

If you only need document processing (PDF, Word, Excel), you can use this minimal requirements.txt:

openai>=1.3.0
PyPDF2>=3.0.1
python-docx>=0.8.11
openpyxl>=3.1.2
xlrd>=2.0.1
python-magic>=0.4.27
python-dotenv>=1.0.0

For multimedia support, add:

google-generativeai>=0.3.0
moviepy>=1.0.3
pydub>=0.25.1

What Works Now

Document Processing (OpenAI)

  • PDF files (.pdf)
  • Text files (.txt)
  • Word documents (.doc, .docx)
  • Excel spreadsheets (.xls, .xlsx)

Multimedia Processing (Gemini)

  • Video files (.mp4, .avi, .mov, .mkv) - with graceful degradation
  • Audio files (.mp3, .wav, .m4a, .webm, .ogg) - with graceful degradation

Core Features

  • Parallel processing
  • Detailed error reporting
  • CLI interface
  • Programmatic API
  • File validation
  • Progress tracking

The tool is fully functional for document processing and will gracefully handle multimedia files even if some dependencies have issues.