Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/saherpathan/invoicify-ai-cohere

A Flask application that extracts invoice details from uploaded PDFs and images using LLM inference API
https://github.com/saherpathan/invoicify-ai-cohere

cohereapi flask-application llm-inference ocr pdfplumber python3

Last synced: about 9 hours ago
JSON representation

A Flask application that extracts invoice details from uploaded PDFs and images using LLM inference API

Awesome Lists containing this project

README

        

# Invoicify-AI πŸ§ΎπŸš€

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.

## ✨ Features

- **πŸ“‚ 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.

## πŸ“‹ Getting Started

### Prerequisites

- 🐍 Python 3.8+
- πŸ“¦ `pip` (Python package installer)
- πŸ”‘ [Cohere API key](https://cohere.ai/) (Add this to a `.env` file)

### Installation

1. **πŸ”— Clone the Repository**

```bash
git clone https://github.com/Saherpathan/invoicify-ai-cohere.git
cd invoicify-ai-cohere
```

2. **🌐 Create a Virtual Environment and Activate It**

```bash
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
```

3. **πŸ“₯ Install the Required Dependencies**

```bash
pip install -r requirements.txt
```

4. **πŸ”§Set Up Environment Variables**

Create a `.env` file in the root directory and add your Cohere API key:

```env
COHERE_API_KEY=
```

5. **▢️ Run the Flask Application Locally**

```bash
python api_call.py
```

The app will be accessible at [http://127.0.0.1:5000](http://127.0.0.1:5000).

## Deployment

### Deploying to Vercel

1. **πŸ›  Install Vercel CLI**

```bash
npm install -g vercel
```

2. **πŸš€Deploy Your Application**

```bash
vercel
```

Follow the prompts to deploy. Vercel will provide you with a URL where your app is live.

### 🌐 Environment Setup on Vercel

When deploying to Vercel, make sure to set the `COHERE_API_KEY` in the Environment Variables settings on the Vercel dashboard.

## Folder Structure

```bash
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
```

## 🀝 Contributing

We welcome contributions to this project. To contribute:

1. **Fork the Repository**: Click the "Fork" button at the top right of this repository.

2. **Create a New Branch**:

```bash
git checkout -b feature/your-feature-name
```

3. **Commit Your Changes**:

```bash
git commit -m "Add your message here"
```

4. **Push to the Branch**:

```bash
git push origin feature/your-feature-name
```

5. **Submit a Pull Request**: Open a pull request to the `main` branch with a description of your changes.

## πŸ“œ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## βœ‰οΈ Contact

For any questions or suggestions, please contact: [[email protected]](mailto:[email protected])