A modern Streamlit application for extracting structured data from invoice images using Qwen 2.5 VL via OpenRouter API.
- 🤖 AI-Powered Extraction - Uses Qwen 2.5 VL model via OpenRouter
- 📱 Modern UI - Responsive design with custom styling
- 📊 Multiple Export Formats - JSON and CSV export options
- 🔧 Configurable - Select which fields to extract
- 🎯 Accurate - Advanced vision model for precise data extraction
- 🔒 Secure - Environment-based API key management
git clone https://github.com/shagatomte19/InvoiceVision.git
cd InvoiceVision
pip install -r requirements.txt
Option A: Streamlit Secrets (Recommended)
mkdir .streamlit
Create .streamlit/secrets.toml
:
OPENROUTER_API_KEY = "your_openrouter_api_key_here"
OPENROUTER_SITE_URL = "https://github.com/shagatomte19/invoice-ocr-extractor"
OPENROUTER_SITE_NAME = "Invoice OCR Extractor"
Option B: Environment Variable
export OPENROUTER_API_KEY="your_api_key_here"
- Visit OpenRouter.ai
- Sign up/login
- Go to API Keys section
- Create new API key
- Copy the key
streamlit run main.py
invoice_ocr_app/
├── main.py # Main application entry point
├── requirements.txt # Python dependencies
├── README.md # This file
├── .gitignore # Git ignore rules
├── .streamlit/
│ └── secrets.toml # Streamlit secrets (not in repo)
├── config/
│ ├── __init__.py
│ └── settings.py # Configuration settings
├── api/
│ ├── __init__.py
│ └── openrouter_client.py # OpenRouter API client
├── utils/
│ ├── __init__.py
│ ├── image_processor.py # Image processing utilities
│ ├── data_parser.py # Data parsing and validation
│ └── export_utils.py # Export functionality
├── ui/
│ ├── __init__.py
│ ├── styles.py # CSS styles
│ ├── components.py # Reusable UI components
│ └── layout.py # Page layout components
└── models/
├── __init__.py
└── invoice_model.py # Invoice data models
- Start Application:
streamlit run main.py
- Configure API: Enter OpenRouter API key (if not using secrets)
- Upload Invoice: Select PNG, JPG, or JPEG image
- Extract Data: Click "Extract Data" button
- Review Results: View structured data extraction
- Export: Download as JSON or CSV
qwen/qwen2.5-vl-72b-instruct:free
(Default, Free tier)qwen/qwen2.5-vl-7b-instruct
qwen/qwen2.5-vl-3b-instruct
- ✅ Vendor Information (name, address, phone, email)
- ✅ Invoice Details (number, date, due date)
- ✅ Financial Data (subtotal, tax, total)
- ✅ Line Items (description, quantity, price)
- API keys are never committed to repository
- Uses Streamlit secrets for secure deployment
- Input validation and error handling
- No data stored permanently
API Key Issues:
- Verify OpenRouter API key is valid
- Check API key has sufficient credits
- Ensure proper configuration in secrets.toml
File Upload Issues:
- Supported formats: PNG, JPG, JPEG
- Ensure image quality is good
- Check file size (recommend < 5MB)
Deployment Issues:
- Verify all dependencies in requirements.txt
- Check Python version compatibility (3.8+)
- Ensure .streamlit/secrets.toml is configured
MIT License - see LICENSE file for details.
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature
) - Commit changes (
git commit -m 'Add amazing feature'
) - Push to branch (
git push origin feature/amazing-feature
) - Open Pull Request
If you find this project helpful, please give it a star! ⭐
- GitHub Issues: Report bugs or request features
- Discussions: Community discussions
Built with ❤️ using Streamlit and Qwen 2.5 VL