update trocr smoke test, add cnnrnn ocr smoke test

This commit is contained in:
Robert Sachunsky 2026-06-03 20:58:05 +02:00
parent 27ca9733db
commit 24c7d4c277

View file

@ -1,16 +1,28 @@
from eynollah.model_zoo import EynollahModelZoo
from eynollah.predictor import Predictor
def test_trocr1(
model_dir,
):
model_zoo = EynollahModelZoo(model_dir)
try:
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
model_zoo.load_models('trocr_processor',
('ocr', 'tr'))
proc = model_zoo.get('trocr_processor')
assert isinstance(proc, TrOCRProcessor)
model_zoo.load_models(('ocr', 'tr'))
model = model_zoo.get('ocr')
assert isinstance(model, VisionEncoderDecoderModel)
assert isinstance(model, Predictor)
shape = model.input_shape
assert len(shape) == 3
except ImportError:
pass
def test_cnnrnnocr1(
model_dir,
):
model_zoo = EynollahModelZoo(model_dir)
try:
model_zoo.load_models('ocr')
model = model_zoo.get('ocr')
assert isinstance(model, Predictor)
shape = model.input_shape
assert len(shape) == 4
except ImportError:
pass