Yaz Hobooti commited on
Commit Β·
c328680
1
Parent(s): fa64916
Add .gitignore and Hugging Face model card
Browse filesFiles changed (2)
- .gitignoreAdded+26
- README.md+22-194
1234567891011121314151617181920212223242526# macOS.DS_Store
# Python__pycache__/*.py[cod]*.egg-info/*.egg*.pyo
# Environments.venv/venv/env/
# Editor/IDE.vscode/.idea/
# Local artifactsProofCheck/.gradio/*.log
# OS/TempThumbs.db*.tmp123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203# PDF Comparison ToolA comprehensive web-based tool for comparing PDF documents with advanced features including OCR validation, color difference detection, spelling verification, and barcode/QR code detection.## Features- **PDF Validation**: Ensures uploaded PDFs contain "50 Carroll" using OCR- **Color Difference Detection**: Identifies visual differences between PDFs and highlights them with red boxes- **Spelling Verification**: Checks text against both English and French dictionaries- **Barcode/QR Code Detection**: Automatically detects and reads barcodes and QR codes- **Visual Comparison**: Side-by-side comparison with annotated differences- **Modern Web Interface**: Responsive design with Bootstrap and custom styling## Requirements### System Requirements- Python 3.7 or higher- macOS, Linux, or Windows- Tesseract OCR engine (for text extraction)### Python DependenciesAll dependencies are listed in `requirements.txt`:- Flask (web framework)- PyPDF2 (PDF processing)- pdf2image (PDF to image conversion)- OpenCV (image processing)- pytesseract (OCR)- pyzbar (barcode detection)- pyspellchecker (spelling verification)- scikit-image (image comparison)- Pillow (image manipulation)## Installation### 1. Install Tesseract OCR**macOS:**```bashbrew install tesseract```**Ubuntu/Debian:**```bashsudo apt-get install tesseract-ocr```**Windows:**Download from [Tesseract GitHub](https://github.com/UB-Mannheim/tesseract/wiki)### 2. Install Python Dependencies```bash# Create virtual environment (recommended)python -m venv venvsource venv/bin/activate # On Windows: venv\Scripts\activate# Install dependenciespip install -r requirements.txt```### 3. Download Language Data (if needed)The application will automatically download required NLTK data on first run.## Usage### 1. Start the Application```bashpython app.py```The application will start on `http://localhost:5000`### 2. Upload PDFs1. Open your web browser and navigate to `http://localhost:5000`2. Select two PDF files for comparison3. Both PDFs must contain "50 Carroll" for validation4. Click "Compare PDFs" to start the analysis### 3. View ResultsThe comparison results are displayed in three tabs:- **Visual Comparison**: Side-by-side view with red boxes highlighting differences- **Spelling Issues**: Table of spelling errors with suggestions from English and French dictionaries- **Barcodes & QR Codes**: List of detected barcodes with their data and positions## File Structure```ProofCheck/βββ app.py # Main Flask applicationβββ pdf_comparator.py # PDF comparison logicβββ requirements.txt # Python dependenciesβββ README.md # This fileβββ templates/β βββ index.html # Main web interfaceβββ static/β βββ css/β β βββ style.css # Custom stylesβ βββ js/β β βββ script.js # Frontend JavaScriptβ βββ results/ # Generated comparison imagesβββ uploads/ # Temporary uploaded filesβββ results/ # Comparison results JSON files```## How It Works### 1. PDF Validation- Converts PDF pages to images using `pdf2image`- Uses Tesseract OCR to extract text- Validates presence of "50 Carroll" in extracted text### 2. Color Difference Detection- Converts PDF pages to images- Resizes images to same dimensions- Uses structural similarity index (SSIM) to detect differences- Draws red rectangles around detected differences### 3. Spelling Verification- Extracts text using OCR- Splits text into individual words- Checks each word against English and French dictionaries- Provides spelling suggestions for incorrect words### 4. Barcode/QR Code Detection- Uses `pyzbar` library to detect barcodes and QR codes- Extracts data and position information- Displays results in organized table format## Configuration### Environment Variables- `FLASK_ENV`: Set to `development` for debug mode- `MAX_CONTENT_LENGTH`: Maximum file upload size (default: 16MB)### Customization- Modify `pdf_comparator.py` to change comparison algorithms- Update `static/css/style.css` for custom styling- Edit `templates/index.html` for interface changes## Troubleshooting### Common Issues1. **Tesseract not found**- Ensure Tesseract is installed and in your system PATH- On macOS, try: `brew install tesseract`2. **PDF processing errors**- Check that PDFs are not corrupted- Ensure PDFs contain readable text (not just images)3. **Memory issues with large PDFs**- Reduce DPI in `pdf_comparator.py` (default: 200)- Process PDFs page by page for very large documents4. **Spelling checker not working**- Ensure internet connection for first run (downloads dictionary data)- Check that `pyspellchecker` is properly installed### Performance Tips- Use smaller DPI values for faster processing- Limit PDF page count for large documents- Ensure sufficient RAM for image processing## Security Considerations- Uploaded files are stored temporarily and cleaned up- File size limits prevent DoS attacks- Input validation prevents malicious file uploads- Session-based file handling ensures isolation## Contributing1. Fork the repository2. Create a feature branch3. Make your changes4. Add tests if applicable5. Submit a pull request## LicenseThis project is open source and available under the MIT License.## SupportFor issues and questions:1. Check the troubleshooting section2. Review the code comments3. Create an issue on the repository## Future Enhancements- Support for more document formats- Advanced text comparison algorithms- Machine learning-based difference detection- Batch processing capabilities- Export functionality for comparison reports12345678910111213141516171819202122232425262728293031---title: ProofChecklicense: apache-2.0tags:- document-processing- ocr- comparatortask_categories:- otherpretty_name: ProofCheck---# ProofCheckProofCheck is a PDF comparison and validation tool that enhances OCR and barcode detection.## Features- High-DPI PDF rendering (600 DPI) for improved OCR and barcode recognition- Rule-based text and layout comparison- Export of comparison results## UsageRun locally:```bashpython run.py```## LicenseApache-2.0
.gitignoreAdded+26
README.md+22-194