"""Minimal usage example.""" import torch from PIL import Image from huggingface_hub import hf_hub_download from modeling import load, preprocess, ctc_greedy path = hf_hub_download("LocalDoc/azerbaijani-ocr-crnn", "model.pt") model, itos = load(path) img = Image.open("line.png") # crop of ONE text line with torch.no_grad(): logits = model(preprocess(img)) print(ctc_greedy(logits, itos))