How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
# Warning: Pipeline type "image-to-text" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline

pipe = pipeline("image-to-text", model="arkhabbazan/ocr-captcha-router")
# Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification

processor = AutoImageProcessor.from_pretrained("arkhabbazan/ocr-captcha-router")
model = AutoModelForImageClassification.from_pretrained("arkhabbazan/ocr-captcha-router", device_map="auto")
Quick Links

Captcha resolver architecture

OCR Captcha Router

A lightweight shared-style captcha router that downloads the selected TrOCR expert on first use. Hugging Face caches downloaded experts locally, and the resolver uses a confidence and grammar-based dual-model fallback for uncertain routes.

Source models

  • Router: arkhabbazan/ocr-captcha-router
  • Math OCR: arkhabbazan/ocr-math-captcha
  • Digit OCR: anuashok/ocr-captcha-v3

Usage

from resolver import CaptchaResolver

resolver = CaptchaResolver.from_pretrained(
    "arkhabbazan/ocr-captcha-router",
    token=True,
    math_confidence_threshold=0.85,
)
print(resolver.predict("captcha.jpeg"))

Keep the captcha at its original aspect ratio. The resolver pads only the router input and leaves OCR preprocessing to each TrOCR processor. The first request for each route downloads that expert; later requests reuse the in-memory model and Hugging Face cache. math_confidence_threshold accepts a value from 0.0 to 1.0; it is the minimum router probability required to choose the math result when both expert outputs match their valid formats.

Downloads last month
100
Safetensors
Model size
2.26M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for arkhabbazan/ocr-captcha-router

Finetuned
(84)
this model