idan1356 / flask_OCR_Service

Optical Character Recognition (OCR) Web Service built with Flask-RESTx. Upload images (JPG, JPEG, PNG) and extract text content using OCR technology. Returns results and processed images.
MIT License
1 stars 0 forks source link
flask model-caching model-deployment ocr-recognition rest-api web-application

Alt text

Optical Character Recognition (OCR) Service

This repository contains a Flask-based REST API for performing Optical Character Recognition (OCR) on uploaded images. It utilizes the Flask-RESTx library to define the API endpoints and manage request and response formats.

Getting Started

Prerequisites

Running the API

  1. Clone this repository: git clone https://github.com/idan1356/flask_OCR_Service.git
  2. Navigate to the project directory: cd ocr-service
  3. Run the application: python app.py

The API will be accessible at http://localhost:5000/api/decipher-text.

API Endpoints

The API documentation provides detailed information about the available endpoints, request and response formats, and example usage. You can access the documentation by visiting /api/docs in your browser.

Upload Image for OCR

Endpoint: POST /api/decipher-text

This endpoint allows you to upload an image for Optical Character Recognition.

Parameters:

Responses:

Project Structure

The project is organized as follows:

OCR Model Caching

The OCR model used by the service is LRU (Least Recently Used) cached to improve performance. The caching is implemented using the functools.lru_cache decorator, to cache OCR models based on the languages used for processing.

Configuration

You can configure languages and other settings in the config file.

Contributing

Contributions are welcome! Please open issues or submit pull requests for bug fixes, features, or improvements.

License

This project is licensed under the MIT License.