This gRPC service provides OCR (Optical Character Recognition) functionality via a wrapper for the Aspose OCR CLI tool. It supports various document area detection modes and can process images provided as local files or URLs.
- Project Overview
- Prerequisites
- Building and Running
- Usage Instructions
- API Documentation
- Example Code
- License
This project provides a gRPC wrapper for the Aspose OCR CLI tool, exposing a gRPC service with the following endpoints:
Process
: Recognizes text from an image using various OCR options.HealthCheck
: Checks the health status of the service.Documentation
: Retrieves the documentation of the service.
- .NET 7.0 SDK
- JetBrains Rider IDE
- Docker
curl
andunzip
(for Docker setup)
- Open the solution in Rider.
- Build the solution.
- Run the project.
The service can be easily deployed using Docker. Follow these steps to build and run the Docker container:
Run the following command to build the Docker image:
docker build -t ocr_service_image .
You can run the Docker container with the necessary environment variables and volume mounts:
docker run -d --name ocr_service_container -v /path/to/temp_storage:/temp_storage -e LICENSE_PATH=/temp_storage/Aspose.OCR.lic -e TEMPORARY_STORAGE=/temp_storage ocr_service_image
docker run -d --name ocr_service_container -v /path/to/temp_storage:/temp_storage -e TEMPORARY_STORAGE=/temp_storage ocr_service_image
- Temporary Storage Volume: The container requires a volume for temporary storage to store intermediate files. Use the
-v /path/to/temp_storage:/temp_storage
option. - License File: If you have an Aspose OCR license, place the license file in your temporary storage defined in previous step. By default, the license file should be named
Aspose.OCR.lic
. Optionally, if you intend to specify strict license file name - set theLICENSE_PATH
environment variable in Docker container startup configuration accordingly.
Once the Docker container is running, you can interact with the gRPC service using grpcurl
, client libraries in various languages, or any gRPC client tool.
See protos/ocr_service.proto
for the full Protobuf definition.
Recognize text from an image using various OCR options.
- Request:
OcrRequest
- Response:
OcrResponse
Check the health status of the service.
- Request:
EchoRequest
- Response:
OcrResponse
Retrieve the documentation for the service.
- Request:
Empty
- Response:
OcrResponse
grpcurl API | Python Example | C# Example | CLI API
MIT License
Copyright (c) 2024 Aspose Pty Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.