LightOnOCR-1B-Demo / README.md
DocUA's picture
Unified project structure: app_space.py for ZeroGPU, root README metadata
a25a813

A newer version of the Gradio SDK is available: 6.13.0

Upgrade
metadata
title: LightOnOCR 1B Demo
emoji: πŸ“–
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 5.42.0
app_file: app_space.py
pinned: false
license: other

LightOnOCR-1B Demo

High-performance OCR application using LightOnOCR-1B model, optimized for Apple Silicon and ZeroGPU.

πŸš€ Performance

  • GGUF Backend: ~3-4 seconds per page (M3 Max)!
  • PyTorch Backend: ~40 seconds per page

Features

  • πŸ“„ PDF and image support
  • πŸ”„ Seamless switching between GGUF and PyTorch backends (Local)
  • πŸŽ›οΈ Configurable resolution (scale) and token generation
  • πŸ–₯️ CLI and Gradio web interface
  • 🍎 Full Metal/MPS support

Quick Start (Local)

1. Prerequisites

  • Python 3.10+
  • cmake and git
pip install -r requirements.txt
pip install accelerate

2. Setup GGUF (Highly Recommended)

See GGUF Setup Guide.

  1. Build llama.cpp locally:
    git clone https://github.com/ggerganov/llama.cpp
    cd llama.cpp && mkdir build && cd build
    cmake .. -DGGML_METAL=ON && cmake --build . --config Release -j 8
    cd ../..
    
  2. Download model:
    python download_gguf_model.py
    

3. Usage

Command Line:

# Fastest
python ocr_cli.py document.pdf --backend gguf

# High Quality
python ocr_cli.py document.pdf --backend gguf --scale 2.0

Web Interface:

python app.py

Open http://127.0.0.1:7860 and select GGUF backend.

Documentation