Skip to content

Deuterrr/docureader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

████▄   ▄▄▄   ▄▄▄▄ ▄▄ ▄▄ ▄▄▄▄  ▄▄▄▄▄  ▄▄▄  ▄▄▄▄  ▄▄▄▄▄ ▄▄▄▄  
██  ██ ██▀██ ██▀▀▀ ██ ██ ██▄█▄ ██▄▄  ██▀██ ██▀██ ██▄▄  ██▄█▄ 
████▀  ▀███▀ ▀████ ▀███▀ ██ ██ ██▄▄▄ ██▀██ ████▀ ██▄▄▄ ██ ██

Document Reader, from Classification to Extraction.

Project Overview

This project is an AI-based [describe function: e.g. document understanding service] built with FastAPI. It uses a modular architecture separating API, use cases, and services (AI model inference, preprocessing, etc.).

Python    FastAPI    YOLOv11    Ultralytics

Folder Structure

├── 📁 src/
│   ├── 📁 core/
│   │   ├── 🐍 config.py
│   │   ├── 🐍 file_checker.py
│   │   ├── 🐍 image_loader.py
│   │   └── 🐍 response_builder.py
│   │
│   ├── 📁 infra/
│   │   ├── 📁 helpers/
│   │   ├── 📁 weights/
│   │   ├── 📁 services/
│   │   └── 📁 models/
│   │       └── 🐍 yolo_model.py
│   │       
│   ├── 📁 lib/
│   │   ├── 📁 app/
│   │   │   └── 📁 usecases/
│   │   │
│   │   ├── 📁 domain/
│   │   │   ├── 📁 entities/
│   │   │   └── 📁 interfaces/
│   │   │
│   │   └── 📁 inter/
│   │       ├── 📁 controllers/
│   │       └── 📁 routes/
│   │
│   └── 🐍 main.py
│
├── ⚙️ .env.example
├── ⚙️ .gitignore
├── 📝 README.md
└── 📄 requirements.txt

Run Locally

1. Clone & Setup

git clone https://github.com/Deuterrr/docureader.git
cd docureader

2. Create Virtual Environment (recommended)

python -m venv .venv

On Linux/Mac

source .venv/bin/activate

On Windows

.venv\Scripts\activate

3. Install Dependencies

pip install --upgrade pip
pip install -r requirements.txt

4. Prepare Model Weights

Create a folder for model weights and place the YOLO .pt file inside it:

mkdir -p infra/weight

Move your model file into:

infra/weight/yolo.pt

Model available on https://drive.google.com/drive/folders/1iYJnvHnOmFYPUZtJtERr9as3okKeD0-v?usp=drive_link

5. Environment Variables

Copy .env.example to .env and fill in the required values.

Add the model path:

KTP_DETECT_MODEL=infra/weight/yolo.pt

6. Run in Development

uvicorn src.main:app --reload

Endpoints

1. Classify KTP Document

URL: /ktp/classify
Method: POST
Description: Classifies the uploaded document to determine if it is a KTP and returns confidence level.

Request:

Parameter Type Description
file UploadFile The image file of the document (JPG/PNG).

Response:

{
    "code": "000",
    "message": "success",
    "data": {
        "doc_type": "ktp",
        "confidence": 0.969,
        "processing_time_ms": 118.41
    }
}
  • doc_type: Detected document type.
  • confidence: Confidence score (0–1) of classification.
  • processing_time_ms: Time taken to process the request.

Notes for Endpoint

  • Only 1 image per input.
  • Only JPG and PNG image are supported.
  • Extract KTP Fields only supports RGB/BRG image input.

About

Small project for reading and extracting content inside document.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages