This project provides an asynchronous service to process image files (JPG/PNG) and extract text from them.
It is built with FastAPI, RabbitMQ, and SQLite, wrapped in Docker for easy setup.
- Producer: FastAPI app for submitting images and querying job status/results
- Consumer: Worker service that consumes jobs from RabbitMQ, extracts text, and stores results in the database
- Common: Shared utilities (DB models, config, RabbitMQ, and Enums)
-
Clone & navigate into the project
git clone https://github.com/Eliorbasli/Image2Text.git cd image2text -
Create a
.envfile in the root folder with your configuration:AMQP_URL=amqp://guest:guest@rabbitmq:5672/ SQLITE_PATH=/data/app.db UPLOAD_DIR=/data/uploads API_NINJAS_KEY = *****************
-
Build and start the services
docker compose up --build
This will start:
- RabbitMQ http://localhost:15672 (
guest/guest) - Producer API (FastAPI) http://localhost:8000
- Consumer worker
To view logs:
docker compose logs -f consumer docker compose logs -f producer
- RabbitMQ http://localhost:15672 (
POST /submit
Upload a JPG/PNG image for text extraction.
Input: multipart/form-data with field file
Response: JSON containing job_id
Example with cURL:
curl -X POST "http://localhost:8000/submit" \
-F "file=@tests/sample_images/test.png"GET /status/{job_id}
Check if the job is queued, processing, done, or failed.
Response:
{
"job_id": "1234-uuid",
"status": "processing"
}GET /result/{job_id}
If the job is done, return the extracted text.
Response:
{
"job_id": "1234-uuid",
"result": "Detected text from image..."
}A sample Python client is included:
cd tests
python python_client.pySample images are available in:

-
RabbitMQ Management
-
FastAPI Docs: