- Docker installed
- Unzip the OCR repository:
unzip ocr.zip cd ocr
- Build the Docker image:
make docker-build
-
Run the Docker container:
make docker-run
- This will start the OCR web service on http://localhost:8000. You can change the port in the docker run command if needed.
-
Access the Swagger Documentation:
- Visit http://localhost:8000/docs in your web browser to access the interactive Swagger documentation. This provides details on the available endpoints, request formats, and response structures.
- The OCR web service provides both synchronous and asynchronous endpoints for text extraction from images.
- URL: http://localhost:8000/imgsync
- Method: POST
- Request Body:
{ "data": "base64_encoded_image" }
- Response:
{ "extracted_text": "extracted_text" }
- URL: http://localhost:8000/imgasync
- Method: POST
- Request Body:
{ "data": "base64_encoded_image" }
- Response:
{ "job_id": "unique_job_id" }
- URL: http://localhost:8000/imgasync/job/{job_id}
- Method: GET
- Response:
{ "job_id": "job_id", "status": "completed", "extracted_text": "extracted_text" }
make clean
: Removes Python compiled files and cache locally.make install
: Installs project dependencies locally.make run
: Runs the OCR web service using Uvicorn locally.make test
: Runs the tests using pytest locally.make docker-run
: Builds a Docker image for the OCR web service and runs it.
ocr
├── __init__.py
├── core
│ ├── __init__.py
│ ├── job_manager.py
│ └── schemas
│ ├── __init__.py
│ └── image.py
├── dependencies.py
├── logger
│ ├── __init__.py
│ └── logger.py
├── main.py
└── routers
├── __init__.py
├── image_sync.py
└── image_async.py
└── utils.py
/imgsync
/imgasync
/imgasync/job/