Instructions to use arkhabbazan/ocr-captcha-router with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use arkhabbazan/ocr-captcha-router with Transformers:
# 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") - Notebooks
- Google Colab
- Kaggle
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
- 76
Model tree for arkhabbazan/ocr-captcha-router
Base model
google/mobilenet_v2_1.0_224