Microservise that uses Flask as a backend for detecting text using tesseract. App contains docker image to be built and run on your machine.
App is running on the localhost port 8000, http://localhost:8000/ocr with POST method for sending images.
I assume you have installed Docker and it is running. See the Docker website for installation instrucitons.
- Clone this repo
git clone https://github.com/mradzikowski/text-detection-restapi.git
- Build the docker image
docker-compose build
- Fire up the container in detached mode
docker-compose up -d
- If you make any change, update the container using command
docker-compose up -d --build
- To see docker-compose logs use:
docker-compose logs
docker-compose exec api python -m pytest "src/tests"
docker-compose exec api flake8 src
docker-compose exec api black src
docker-compose exec api isort src
curl -X POST http://localhost:8000/ocr -F "file=@{your_file_name.jpg}"
[
{
"left": 71,
"top": 67,
"right": 155,
"bottom": 78,
"text": "GALARETKA"
},
{
"left": 79,
"top": 137,
"right": 147,
"bottom": 151,
"text": "cytrynowa"
},
{
"left": 240,
"top": 74,
"right": 279,
"bottom": 86,
"text": "mleko"
},
{
"left": 363,
"top": 148,
"right": 407,
"bottom": 163,
"text": "woda"
}
]