████▄ ▄▄▄ ▄▄▄▄ ▄▄ ▄▄ ▄▄▄▄ ▄▄▄▄▄ ▄▄▄ ▄▄▄▄ ▄▄▄▄▄ ▄▄▄▄
██ ██ ██▀██ ██▀▀▀ ██ ██ ██▄█▄ ██▄▄ ██▀██ ██▀██ ██▄▄ ██▄█▄
████▀ ▀███▀ ▀████ ▀███▀ ██ ██ ██▄▄▄ ██▀██ ████▀ ██▄▄▄ ██ ██
Document Reader, from Classification to Extraction.
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.).
├── 📁 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
git clone https://github.com/Deuterrr/docureader.git
cd docureaderpython -m venv .venvOn Linux/Mac
source .venv/bin/activateOn Windows
.venv\Scripts\activatepip install --upgrade pip
pip install -r requirements.txtCreate a folder for model weights and place the YOLO .pt file inside it:
mkdir -p infra/weightMove your model file into:
infra/weight/yolo.ptModel available on https://drive.google.com/drive/folders/1iYJnvHnOmFYPUZtJtERr9as3okKeD0-v?usp=drive_link
Copy .env.example to .env and fill in the required values.
Add the model path:
KTP_DETECT_MODEL=infra/weight/yolo.ptuvicorn src.main:app --reloadURL: /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.
- Only 1 image per input.
- Only JPG and PNG image are supported.
- Extract KTP Fields only supports RGB/BRG image input.