sgalle/text-recognition-api
0
Scene Text Detection and Recognition API
This project provides an API for scene text detection and recognition. It utilizes the CRAFT model for text detection and the PARSeq model for text recognition. For efficient inference, both models have been converted to the ONNX format and are executed using ONNX Runtime.
The application, built with FastAPI, offers two primary endpoints: one that returns predictions as JSON and another that provides an interactive demo built with Gradio.
Setup
- Clone the repository:
git clone https://github.com/sgalle9/text-recognition-api.git
cd text-recognition-api- Add assets and models:
- Place a sample image inside the
assetsfolder and ensure it is namedexample.jpg. This will be used as the default example in the Gradio demo. - Download the
.onnxmodel files from the Releases page and place them inside themodelsfolder.
- (Optional) Configure the API: You can modify the API's global constants by editing the
app/config.pyfile.
- Build the Docker image:
docker build -t ocr .Usage
- Run the API:
docker run --rm -it -p 7860:7860 ocr- Access the Endpoints:
- Interactive Demo: Go to http://localhost:7860/demo.
- API Documentation: Go to http://localhost:7860/docs.
