🧾 Invoice Extractor with Google Gemini
A Streamlit-based application that extracts key information from invoices using Google Gemini LLM model. This tool allows users to upload invoice files (PDF/JPG/PNG), and the Gemini model automatically extracts structured data such as invoice number, date, vendor, line items, totals, and more.
🔍 Overview
This project demonstrates how to build an AI-powered Invoice Extraction System using the Google Gemini Pro API. It uses:
-
Gemini Model (via Google GenAI) for document analysis
-
Streamlit for the user interface
-
Python backend to process invoice files
-
Users upload an invoice and receive structured extracted data instantly.
🚀 Getting Started
Follow the steps below to set up and run the project locally.
📦 Prerequisites
Before starting, ensure you have:
-
Python 3.10+
-
Google Gemini API Key
🔑 How to Obtain a Gemini API Key
-
Visit: https://aistudio.google.com/
-
Log in with your Google account
-
Navigate to API Keys
-
Create a new API key
-
Copy the key and store it securely
-
You will use this key in a .env file or environment variable.
⚙️ Setup & Installation
1️⃣ Clone the Repository
git clone <repository_url>
cd <repository_name> 2️⃣ Create and Activate Virtual Environment
Using uv (recommended):
pip install uv
uv venv
### Activate:
### Mac/Linux:
source .venv/bin/activate
### Windows
.venv\Scripts\activate
3️⃣ Install Dependencies
uv add -r requirements.txt4️⃣ Add Your Google API Key
GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"streamlit run app.py🧾 How It Works
-
Upload an invoice file (PDF, PNG, JPG)
-
The app sends the document to Gemini Pro Vision
-
The model extracts:
-
Invoice number
-
Invoice date
-
Vendor / company name
-
Line items (qty, price, description)
-
Tax & totals
- Extracted data is displayed in a structured format