diff --git a/app/daemon/job_utils.py b/app/daemon/job_utils.py index 32def73d..99a6ee75 100644 --- a/app/daemon/job_utils.py +++ b/app/daemon/job_utils.py @@ -59,6 +59,8 @@ def _create_job_service(job): command += f' -m {job.service_args["model"]}' if 'binarization' in job.service_args and job.service_args['binarization']: command += ' --binarize' + value = job.service_args['ocropus_nlbin_threshold'] + command += f' --ocropus-nlbin-threshold {value}' elif job.service == 'transkribus-htr-pipeline': transkribus_htr_pipeline_model_id = job.service_args['model'] command += f' -m {transkribus_htr_pipeline_model_id}' diff --git a/app/services/forms.py b/app/services/forms.py index 9d7edf80..97218ddb 100644 --- a/app/services/forms.py +++ b/app/services/forms.py @@ -3,7 +3,7 @@ from flask_wtf import FlaskForm from flask_wtf.file import FileField, FileRequired from wtforms import ( BooleanField, - IntegerRangeField, + DecimalRangeField, MultipleFileField, SelectField, StringField, @@ -50,8 +50,8 @@ class CreateTesseractOCRPipelineJobForm(CreateJobBaseForm): binarization = BooleanField('Binarization') pdf = FileField('File', validators=[FileRequired()]) model = SelectField('Model', validators=[InputRequired()]) - ocropus_nlbin_threshold = IntegerRangeField( - render_kw={'tooltips':'false', 'min': 0, 'max': 1, 'step': 0.1, 'start': [0.5]} + ocropus_nlbin_threshold = DecimalRangeField( + render_kw={'min': 0, 'max': 1, 'step': 0.1, 'start': [0.5]} ) def validate_binarization(self, field): diff --git a/app/services/routes.py b/app/services/routes.py index 7fe7a0eb..4e0266d8 100644 --- a/app/services/routes.py +++ b/app/services/routes.py @@ -79,7 +79,7 @@ def tesseract_ocr_pipeline(): service_args={ 'binarization': form.binarization.data, 'model': hashids.decode(form.model.data), - 'ocropus_nlbin_threshold': form.ocropus_nlbin_threshold.data + 'ocropus_nlbin_threshold': float(form.ocropus_nlbin_threshold.data) }, service_version=form.version.data, user=current_user diff --git a/app/templates/services/tesseract_ocr_pipeline.html.j2 b/app/templates/services/tesseract_ocr_pipeline.html.j2 index 31bf155c..8f4f2cc4 100644 --- a/app/templates/services/tesseract_ocr_pipeline.html.j2 +++ b/app/templates/services/tesseract_ocr_pipeline.html.j2 @@ -85,7 +85,7 @@

 

-

Intensity

+

Intensity (between 0 and 1)

{{ form.ocropus_nlbin_threshold() }}