diff --git a/app/services/forms.py b/app/services/forms.py index 2f4a1b51..5de8af07 100644 --- a/app/services/forms.py +++ b/app/services/forms.py @@ -1,5 +1,6 @@ from flask_wtf import FlaskForm -from wtforms import MultipleFileField, SelectField, StringField, SubmitField, ValidationError +from wtforms import (BooleanField, MultipleFileField, SelectField, StringField, + SubmitField, ValidationError) from wtforms.validators import DataRequired, Length @@ -34,6 +35,7 @@ class NewNLPJobForm(FlaskForm): class NewOCRJobForm(FlaskForm): + binarization = BooleanField('Binarazation') description = StringField('Description', validators=[DataRequired(), Length(1, 255)]) files = MultipleFileField('Files', validators=[DataRequired()]) @@ -49,6 +51,7 @@ class NewOCRJobForm(FlaskForm): ('por', 'Portuguese'), ('spa', 'Spanish; Castilian')], validators=[DataRequired()]) + split = BooleanField('Split') submit = SubmitField('Submit') title = StringField('Title', validators=[DataRequired(), Length(1, 32)]) version = SelectField('Version', diff --git a/app/services/views.py b/app/services/views.py index 7f624f7d..6d785bfb 100644 --- a/app/services/views.py +++ b/app/services/views.py @@ -62,9 +62,13 @@ def ocr(): mem_mb=8192, n_cores=4, service='ocr', - service_args=json.dumps([ - '-l {}'.format(new_ocr_job_form.language.data), - '--skip-binarisation']), + service_args=json.dumps( + [ + '-l {}'.format(new_ocr_job_form.language.data), + '' if new_ocr_job_form.binarization.data + else '--skip-binarisation' + ] + ), service_version=new_ocr_job_form.version.data, status='preparing', title=new_ocr_job_form.title.data) diff --git a/app/templates/services/ocr.html.j2 b/app/templates/services/ocr.html.j2 index 32f995d7..5c3a542a 100644 --- a/app/templates/services/ocr.html.j2 +++ b/app/templates/services/ocr.html.j2 @@ -88,8 +88,7 @@ {% endfor %} - -
+
@@ -114,6 +113,23 @@ {% endfor %}
+
+
+
+ +
+
+ +
+