An endpoint was developed with Python FastAPI for scanning election minutes, detecting and reading QR, detecting table fields with vote numbers and reading values with OCR.
- uvicorn secim_tutanak_ocr_api.main:app --reload --host 0.0.0.0 --port 8080
- Build
docker build -t secim-tutanak-ocr-api .
- RUN
docker run -p 8080:8080 -it --rm --gpus all -v secim-tutanak-ocr-vol:/code/ -t secim-tutanak-ocr-api
- Build & Run
*
docker-compose -f docker-compose.dev.yml up --build
OCR Endpoint POST:
http://127.0.0.1:8080/api/ocr/predimg"
Usage Example Python:
file_path = '17013_bulk_999999999_1684082326979111104.jpeg'
#read image as byte
with open(file_path, 'rb') as f:
img_file = f.read()
#send image as byte with file tag
files = {'file': ('custom_test_img.jpg',img_file,'multipart/form-data')}
# [POST] Request to api
response_predict = requests.post(url, files=files)
Reference: https://github.com/NaturalHistoryMuseum/pyzbar/
Reference: Demo: https://huggingface.co/TahaDouaji/detr-doc-table-detection
Referance: https://github.com/PaddlePaddle/PaddleOCR