Coder Social home page Coder Social logo

ocr's Introduction

OCR Web Service

Table of Contents

Building the OCR Web Service

Prerequisites

Instructions

  1. Unzip the OCR repository:
    unzip ocr.zip
    cd ocr
  2. Build the Docker image:
    make docker-build

Running the OCR Web Service

Instructions

  1. Run the Docker container:

    make docker-run
    • This will start the OCR web service on http://localhost:8000. You can change the port in the docker run command if needed.
  2. Access the Swagger Documentation:

  • Visit http://localhost:8000/docs in your web browser to access the interactive Swagger documentation. This provides details on the available endpoints, request formats, and response structures. Swagger Documentation

Using the OCR Web Service

  • The OCR web service provides both synchronous and asynchronous endpoints for text extraction from images.

Synchronous Endpoint (imgsync)

  • URL: http://localhost:8000/imgsync
  • Method: POST
  • Request Body:
    {
      "data": "base64_encoded_image"
    }
  • Response:
    {
      "extracted_text": "extracted_text"
    }

Asynchronous Endpoint (imgasync)

Check Asynchronous Job Status

Reference

Commands in Makefile

  1. make clean: Removes Python compiled files and cache locally.
  2. make install: Installs project dependencies locally.
  3. make run: Runs the OCR web service using Uvicorn locally.
  4. make test: Runs the tests using pytest locally.
  5. make docker-run: Builds a Docker image for the OCR web service and runs it.

Core Hierarchy

ocr
├── __init__.py
├── core
│   ├── __init__.py
│   ├── job_manager.py
│   └── schemas
│       ├── __init__.py
│       └── image.py
├── dependencies.py
├── logger
│   ├── __init__.py
│   └── logger.py
├── main.py
└── routers
    ├── __init__.py
    ├── image_sync.py
    └── image_async.py
    └── utils.py

Demo by Swagger UI

  1. /imgsync
  • Input an encoded image data, get the result as Swagger Documentation
  1. /imgasync
  • Input an encoded image data, get the result as Swagger Documentation
  1. /imgasync/job/
  • Based on the job_id from /imgasync, we have Swagger Documentation

ocr's People

Contributors

egpivo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.