from flask import request, url_for
from app.models import TesseractOCRPipelineModel


def tesseract_ocr_pipeline_model_dlc():
    topm_id = request.view_args['tesseract_ocr_pipeline_model_id']
    topm = TesseractOCRPipelineModel.query.get_or_404(topm_id)
    return [
        {
            'text': f'{topm.title} {topm.version}',
            'url': url_for('.tesseract_ocr_pipeline_model', tesseract_ocr_pipeline_model_id=topm_id)
        }
    ]
