Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– AI Bill of Lading Extractor using OCR & Google Gemini AI

An AI-powered web application that automatically extracts structured information from Bill of Lading (B/L) PDF documents using Google Gemini AI, Tesseract OCR, PyMuPDF, FastAPI, and React. The extracted shipment information is displayed through an interactive dashboard and can be exported as Excel or JSON.


πŸ“Œ Project Overview

The AI Bill of Lading Extractor is designed to automate the extraction of shipment information from Bill of Lading documents used in the logistics and shipping industry.

Traditional document processing requires manual reading and data entry, which is time-consuming and prone to errors. This project uses Artificial Intelligence and OCR to automatically extract structured information from both digital and scanned Bill of Lading PDFs.

If the uploaded PDF contains embedded text, the application extracts it using PyMuPDF. If the PDF is scanned, it automatically switches to Tesseract OCR. The extracted text is then analyzed by Google Gemini AI, which converts the unstructured text into structured shipment information.

The extracted information is displayed in a responsive React dashboard and can be downloaded as Excel or JSON.


✨ Features

  • πŸ“„ Upload Bill of Lading PDF
  • πŸ€– AI-powered data extraction using Google Gemini AI
  • πŸ” Automatic OCR for scanned PDFs
  • πŸ“‘ Multi-page PDF support
  • 🚒 Shipment Header extraction
  • πŸ“¦ Container Details extraction
  • πŸ“Š Shipment Summary generation
  • πŸ“₯ Export extracted data to Excel
  • πŸ“„ Export extracted data to JSON
  • ⚑ FastAPI backend
  • βš› React frontend
  • πŸ“± Responsive user interface

⭐ Key Highlights

  • Supports both digital and scanned Bill of Lading PDFs.
  • Automatically detects when OCR is required.
  • Uses Google Gemini AI for intelligent document understanding.
  • Extracts structured shipment information with high accuracy.
  • Generates Excel and JSON reports.
  • Clean and responsive React dashboard.
  • REST API developed using FastAPI.
  • Modular and scalable project architecture.

πŸ›  Technology Stack

Frontend

  • React (Vite)
  • JavaScript (ES6)
  • CSS3
  • Axios

Backend

  • Python
  • FastAPI
  • Uvicorn

AI & OCR

  • Google Gemini AI
  • Tesseract OCR
  • PyMuPDF (fitz)

Data Processing

  • Pandas
  • OpenPyXL

πŸ“‚ Project Structure

AI-BL-Extractor/
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── main.py
β”‚   β”‚
β”‚   β”œβ”€β”€ uploads/
β”‚   β”œβ”€β”€ output/
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── .env
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ styles/
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   └── main.jsx
β”‚   β”‚
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ screenshots/
β”‚
β”œβ”€β”€ README.md
β”œβ”€β”€ API_DOCUMENTATION.md
└── LICENSE

πŸš€ Installation

Clone Repository

git clone https://github.com/MdNvD/AI-BL-Extractor.git

Backend Setup

cd backend

python -m venv venv

venv\Scripts\activate

pip install -r requirements.txt

Create a .env file:

GEMINI_API_KEY=YOUR_GEMINI_API_KEY

Run the backend:

uvicorn app.main:app --reload

Backend URL

http://127.0.0.1:8000

Frontend Setup

cd frontend

npm install

npm run dev

Frontend URL

http://localhost:5173

πŸ”„ Application Workflow

Upload Bill of Lading PDF
            β”‚
            β–Ό
Detect PDF Type
            β”‚
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚              β”‚
      β–Ό              β–Ό
Digital PDF     Scanned PDF
      β”‚              β”‚
      β–Ό              β–Ό
 PyMuPDF      Tesseract OCR
      β”‚              β”‚
      β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
             β–Ό
      Extracted Text
             β–Ό
     Google Gemini AI
             β–Ό
 Structured Shipment Data
             β–Ό
 Display in React Dashboard
             β–Ό
 Excel / JSON Export

πŸ“‹ Extracted Information

Shipment Header

  • Carrier
  • Bill of Lading Number
  • Vessel
  • Voyage
  • Port of Loading
  • Port of Discharge
  • Place of Receipt
  • Place of Delivery
  • Freight
  • Shipper
  • Consignee
  • Notify Party

Container Details

  • Container Number
  • Seal Number
  • Container Size
  • Cartons
  • Weight
  • CBM

Shipment Summary

  • Total Containers
  • Total Cartons
  • Total Weight
  • Total CBM

🎯 Demo Output

The application successfully extracts:

  • βœ… Shipment Header
  • βœ… Carrier Details
  • βœ… Bill of Lading Number
  • βœ… Vessel & Voyage
  • βœ… Shipper Information
  • βœ… Consignee Information
  • βœ… Notify Party
  • βœ… Container Details
  • βœ… Shipment Summary
  • βœ… Excel Report
  • βœ… JSON Report

πŸ“Έ Screenshots

🏠 Home Page

Home


πŸ“€ Upload PDF

Upload


πŸ€– AI Extraction Result

Extraction


πŸ“‹ Shipment Information

Shipment Information


πŸ“¦ Container Details

Container Table


πŸ“Š Shipment Summary

Summary


πŸ“„ Container Details (Excel)

Container Details Excel


πŸ“ˆ Shipment Summary (Excel)

Shipment Summary Excel


πŸ“₯ Export Results

Export


⏳ Processing Screen

Loading


🌐 API Endpoints

Method Endpoint Description
POST /api/upload Upload Bill of Lading PDF
GET /api/bl-extract/{filename} Extract shipment information
GET /api/download/excel/{filename} Download Excel report
GET /api/download/json/{filename} Download JSON report

For detailed API documentation, see API_DOCUMENTATION.md.


🎯 Future Enhancements

  • User Authentication
  • Batch PDF Processing
  • Cloud Deployment
  • Database Integration
  • AI Confidence Score
  • Dashboard Analytics
  • Search & Filter
  • Support for Invoice, Packing List and Commercial Invoice
  • Docker Deployment

πŸ‘¨β€πŸ’» Author

Mohamed Navith

B.Tech – Computer Science and Engineering

Passionate about Full Stack Development, Artificial Intelligence, and Cloud Technologies.


πŸ“œ License

This project is licensed under the MIT License.


⭐ Support

If you found this project helpful, consider giving it a ⭐ on GitHub.

About

AI-powered Bill of Lading data extraction system built with FastAPI, React, OCR (Tesseract), and Google Gemini AI. Supports structured JSON and Excel export.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages