Image-to-Text
PyTorch
Azerbaijani
ocr
azerbaijani
cyrillic
crnn
ctc
File size: 406 Bytes
62067c9
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""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))