Skip to content

Eliorbasli/Image2Text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Asynchronous Image Processing Service

Overview

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)
Image2Text Diagram

How to Run

  1. Clone & navigate into the project

    git clone https://github.com/Eliorbasli/Image2Text.git
    cd image2text
  2. Create a .env file 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 = *****************
  3. Build and start the services

    docker compose up --build

    This will start:

    To view logs:

    docker compose logs -f consumer
    docker compose logs -f producer

API Endpoints

1. Submit a new image job

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"

2. Get job status

GET /status/{job_id}

Check if the job is queued, processing, done, or failed.

Response:

{
  "job_id": "1234-uuid",
  "status": "processing"
}

3. Get job result

GET /result/{job_id}

If the job is done, return the extracted text.

Response:

{
  "job_id": "1234-uuid",
  "result": "Detected text from image..."
}

Testing the API

A sample Python client is included:

cd tests
python python_client.py

Sample images are available in:
image


UI Previews

  • RabbitMQ Management

  • FastAPI Docs:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published