Skip to main content

A reverse OCR tool that renders huggingface-compatible datasets to images of specified sizes (e.g., `512x512`).

Project description

DeOCR

DeOCR (de-cor), A reverse OCR tool that renders huggingface-compatible datasets to images of specified sizes (e.g., 512x512). This tool can be considered as a text-to-image data pre-processing component in pipelines such as DeepSeek-OCR.

---
title: DeOCR Usage in LLM Pipeline
---
flowchart LR
  TEXTDATA[/"some context in text form"/]
  MMDATA[/"Does this particular car <br/> &lt;image&gt; present in here &lt;image&gt; ?"/]
  HFDATASET[("huggingface dataset")] 
  subgraph DeOCR
    CSS1["cli --style red-text textit"]
    CSS2["cli --style default"]
    CSS3["cli --style default"]
    MAPPER["DeOCR Dataset Mapper"]
  end
  TEXTDATA --> CSS1 --> IMG1[["some context in text form"]]:::redText
  TEXTDATA --> CSS2 --> IMG2[["some context in text form"]]
  MMDATA --> CSS3 --> IMG3[["Does this particular car <br/> 🖼️🖼️🖼️🖼️🖼️🖼️🖼️<br/>🖼️🖼️🖼️🚗🖼️🖼️🖼️<br/>🖼️🖼️🖼️🖼️🖼️🖼️🖼️<br/> present in here <br/> 🖼️🖼️🖼️🖼️🖼️🖼️🖼️<br/>🖼️🖼️🖼️🖼️🖼️🖼️🖼️<br/>🖼️🖼️🖼️🖼️🖼️🖼️🖼️<br/>?"]]
  HFDATASET --> MAPPER --> DEOCRDATASET[("🖼️ imagified dataset")]
  DEOCRDATASET & IMG1 & IMG2 & IMG3 -.-> MODEL["LLMs or VLMs<br/> Evaluation"]
  classDef redText color:#ff0000,font-style:italic;
  IMG1 ~~~|"fa:fa-mobile-screen A screenshot of text <br/>w. special formatting"| IMG1
  IMG2 ~~~|"fa:fa-mobile-screen A plain screenshot of text"| IMG2
  IMG3 ~~~|"fa:fa-mobile-screen A screenshot of both text and images"| IMG3
Here is an output example, sized `512x512`, with random string as context

a 512x512 example

Quick Start

pip install deocr
# activate your python environment, then install playwright deps
playwright install chromium
Alternatively, install from source
# uv
uv add "deocr @ git+https://github.com/Moenupa/DeOCR.git"
# for pip or conda
pip install "git+https://github.com/Moenupa/DeOCR.git"
# activate your python environment, then install playwright deps
playwright install chromium
For development

Please use uv to manage the environment:

git clone https://github.com/Moenupa/DeOCR.git
cd DeOCR
uv venv
uv sync --dev
source .venv/bin/activate
playwright install chromium
pre-commit install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deocr-0.1.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deocr-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file deocr-0.1.1.tar.gz.

File metadata

  • Download URL: deocr-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for deocr-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e319d012d2bc0d52cfd8070363a9eba801b9ef7a711f94cd2a526428e47c2af9
MD5 dbe4cc2c198e5083d58e1c0eded5d757
BLAKE2b-256 995f4774454a6abada5b5d06f7769388c51d83cd9b2c10116e50643e25170481

See more details on using hashes here.

File details

Details for the file deocr-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: deocr-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for deocr-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a36564cf07923b1b067157cacb5f044344e5d6d516948c285dbc772df3b49ef3
MD5 232b071ed9ccbf2ee3375d125f8b1827
BLAKE2b-256 5d8c01241371d953c3b4d8c52edc873b77dc6240ff99d410044680804c9bd6d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page