Uses gosseract (wrapper for tesseract-ocr) to provide a service which returns text from an image. Input options are image URL and image upload using a multipart-form.
docker run --name ocr-service --restart unless-stopped -p 8123:8123 -e PORT=8123 -e AUTH_KEY=secret123 ghcr.io/mismaah/ocr-service:main
AUTH_KEY
is an optional environment variable. If this is set, all API calls should have the Authorization header.
curl --location --request POST 'http://localhost:8123/text/url?url=https://image.png' --header 'Authorization: ••••••'
curl --location 'http://localhost:8123/text/upload' --header 'Authorization: ••••••' --form 'file=@"file.jpg"'
If successful, returns the text from the image:
{
"text": "Example text from the image."
}
If error, returns the error message:
{
"error": "Error reading from image."
}