A Flask application that extracts invoice details from uploaded PDFs and images using pdfplumber
, pytesseract
, and the Cohere API for natural language processing. The extracted data is displayed in a user-friendly format and can be downloaded as JSON.
- 📂 Upload PDF or Image Files: Supports PDFs and images in PNG, JPG, JPEG formats.
- 🤖 AI-Powered Extraction: Utilizes Cohere API to extract invoice details such as customer information, product details, and total amount.
- 👌User-Friendly Interface: Simple and intuitive UI for uploading files and viewing results.
- 💾 Downloadable JSON: Extracted data can be downloaded as a JSON file.
- 🚀 Deployment Support: Ready for deployment on Vercel.
- 🐍 Python 3.8+
- 📦
pip
(Python package installer) - 🔑 Cohere API key (Add this to a
.env
file)
-
🔗 Clone the Repository
git clone https://github.com/Saherpathan/invoicify-ai-cohere.git cd invoicify-ai-cohere
-
🌐 Create a Virtual Environment and Activate It
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
📥 Install the Required Dependencies
pip install -r requirements.txt
-
🔧Set Up Environment Variables
Create a
.env
file in the root directory and add your Cohere API key:COHERE_API_KEY=<your_cohere_api_key>
-
▶️ Run the Flask Application Locallypython api_call.py
The app will be accessible at http://127.0.0.1:5000.
-
🛠 Install Vercel CLI
npm install -g vercel
-
🚀Deploy Your Application
vercel
Follow the prompts to deploy. Vercel will provide you with a URL where your app is live.
When deploying to Vercel, make sure to set the COHERE_API_KEY
in the Environment Variables settings on the Vercel dashboard.
invoicify-ai-cohere/
│
├── requirements.txt # Python dependencies
├── vercel.json # Vercel deployment configuration
├── .env # Environment variables
├── /api # Main Flask application script
| └── api_call.py
│ └──/templates
│ ├── index.html # Home page for file uploads
│ └── result.html # Result page displaying extracted details
├── /output # JSON outputs of extracted details
├── /uploads # Uploaded files
└── README.md # Project documentation
We welcome contributions to this project. To contribute:
-
Fork the Repository: Click the "Fork" button at the top right of this repository.
-
Create a New Branch:
git checkout -b feature/your-feature-name
-
Commit Your Changes:
git commit -m "Add your message here"
-
Push to the Branch:
git push origin feature/your-feature-name
-
Submit a Pull Request: Open a pull request to the
main
branch with a description of your changes.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or suggestions, please contact: [email protected]