Perform optical character recognition using the EasyOCR library
Project description
Sinapsis EasyOCR
EasyOCR-based Optical Character Recognition (OCR) for images
🐍 Installation • 🚀 Features • 📚 Usage example • 🌐 Webapp • 📙 Documentation • 🔍 License
Sinapsis EasyOCR provides a powerful and flexible implementation for extracting text from images using the EasyOCR engine. It enables users to easily configure and run OCR tasks with minimal setup.
🐍 Installation
Install using your package manager of choice. We encourage the use of uv
Example with uv:
uv pip install sinapsis-easyocr --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-easyocr --extra-index-url https://pypi.sinapsis.tech
[!IMPORTANT] Templates may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
with uv:
uv pip install sinapsis-easyocr[all] --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-easyocr[all] --extra-index-url https://pypi.sinapsis.tech
[!TIP] Use CLI command
sinapsis info --all-template-namesto show a list with all the available Template names installed with Sinapsis OCR.
[!TIP] Use CLI command
sinapsis info --example-template-config EasyOCRto produce an example Agent config for the EasyOCR template.
🚀 Features
Templates Supported
This module includes a template tailored for the EasyOCR engine:
- EasyOCR: Extracts text from images using EasyOCR, along with their bounding boxes and confidence scores.
EasyOCR Attributes
reader_params(dict): Parameters for initializing the EasyOCR Reader. Defaults to{"lang_list": ["en"]}.read_text_params(dict, optional): Parameters for the EasyOCR readtext method. Defaults toNone.get_full_text(bool): Whether to save detected text in a TextPacket. Defaults toFalse.
📚 Usage example
EasyOCR Example
agent:
name: easyocr_inference
description: agent to run inference with EasyOCR, performs on images read, recognition and save
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: FolderImageDatasetCV2
class_name: FolderImageDatasetCV2
template_input: InputTemplate
attributes:
data_dir: dataset/input
- template_name: EasyOCR
class_name: EasyOCR
template_input: FolderImageDatasetCV2
attributes: {}
- template_name: BBoxDrawer
class_name: BBoxDrawer
template_input: EasyOCR
attributes:
draw_confidence: True
draw_extra_labels: True
- template_name: ImageSaver
class_name: ImageSaver
template_input: BBoxDrawer
attributes:
save_dir: output
root_dir: dataset
To run, simply use:
sinapsis run name_of_the_config.yml
🌐 Webapp
The webapp provides a simple interface to extract text from images using EasyOCR. Upload your image, and the app will process it and display the detected text with bounding boxes.
[!IMPORTANT] To run the app you first need to clone the sinapsis-ocr repository:
git clone https://github.com/Sinapsis-ai/sinapsis-ocr.git
cd sinapsis-ocr
[!NOTE] If you'd like to enable external app sharing in Gradio,
export GRADIO_SHARE_APP=True
[!TIP] By default, the webapp uses EasyOCR. No additional configuration is needed.
🐳 Docker
IMPORTANT This docker image depends on the sinapsis:base image. Please refer to the official sinapsis instructions to Build with Docker.
- Build the sinapsis-ocr image:
docker compose -f docker/compose.yaml build
- Start the app container:
docker compose -f docker/compose_app.yaml up
- Check the status:
docker logs -f sinapsis-ocr-app
- The logs will display the URL to access the webapp, e.g.:
NOTE: The url can be different, check the output
Running on local URL: http://127.0.0.1:7860
- To stop the app:
docker compose -f docker/compose_app.yaml down
💻 UV
To run the webapp using the uv package manager, please:
- Create the virtual environment and sync the dependencies:
uv sync --frozen
- Install packages:
uv pip install sinapsis-easyocr[all] --extra-index-url https://pypi.sinapsis.tech
- Run the webapp:
uv run webapps/gradio_ocr.py
- The terminal will display the URL to access the webapp, e.g.:
Running on local URL: http://127.0.0.1:7860
NOTE: The url can be different, check the output of the terminal
- To stop the app press
Control + Con the terminal
📙 Documentation
Documentation for this and other sinapsis packages is available on the sinapsis website
Tutorials for different projects within sinapsis are available at sinapsis tutorials page
🔍 License
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.
For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sinapsis_easyocr-0.1.3.tar.gz.
File metadata
- Download URL: sinapsis_easyocr-0.1.3.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
276fee3a40bcb4b935ee4e82e3aa07327dfe5a7e2f27fc8db28715ad66120e0a
|
|
| MD5 |
adca16801cdeabb935afdfbd3382c1f7
|
|
| BLAKE2b-256 |
0ee5352b0f1bd84d9ef58222f4bfb378eeac2aac1c6963d85dd1fc3ccb294f2e
|
File details
Details for the file sinapsis_easyocr-0.1.3-py3-none-any.whl.
File metadata
- Download URL: sinapsis_easyocr-0.1.3-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8844b59e68b789ab39f11f8761e7986a07ae8ab7d3270dffa352b8d9a87ac02a
|
|
| MD5 |
04401c73d6fc1fe080ab4bad2a661797
|
|
| BLAKE2b-256 |
fc2576469e9203cfefad1a00b12ba8d8f7ea5f7be64afe7546490b96ab639a47
|