Add changes for new OCR and NLP Pipelines

This commit is contained in:
Patrick Jentsch 2020-04-03 17:36:38 +02:00
parent 498defa386
commit 9da08508c0
3 changed files with 8 additions and 12 deletions

View File

@ -21,9 +21,7 @@ class AddNLPJobForm(FlaskForm):
validators=[DataRequired()]) validators=[DataRequired()])
submit = SubmitField() submit = SubmitField()
title = StringField('Title', validators=[DataRequired(), Length(1, 32)]) title = StringField('Title', validators=[DataRequired(), Length(1, 32)])
version = SelectField('Version', version = SelectField('Version', choices=[('latest', 'Latest')],
choices=[('2.2.0', 'Latest (2.2.0)'),
('2.2.0', '2.2.0')],
validators=[DataRequired()]) validators=[DataRequired()])
check_encoding = BooleanField('Check encoding') check_encoding = BooleanField('Check encoding')
@ -54,15 +52,14 @@ class AddOCRJobForm(FlaskForm):
split = BooleanField('Split') split = BooleanField('Split')
submit = SubmitField() submit = SubmitField()
title = StringField('Title', validators=[DataRequired(), Length(1, 32)]) title = StringField('Title', validators=[DataRequired(), Length(1, 32)])
version = SelectField('Version', version = SelectField('Version', choices=[('latest', 'Latest')],
choices=[('latest', 'Latest')],
validators=[DataRequired()]) validators=[DataRequired()])
def validate_files(form, field): def validate_files(form, field):
for file in field.data: for file in field.data:
if not file.filename.lower().endswith(('.pdf', '.tif', '.tiff')): if not file.filename.lower().endswith('.pdf'):
raise ValidationError('File does not have an approved ' raise ValidationError('File does not have an approved '
'extension: .pdf | .tif | .tiff') 'extension: .pdf')
class AddSetupFilesJobForm(FlaskForm): class AddSetupFilesJobForm(FlaskForm):
@ -71,8 +68,7 @@ class AddSetupFilesJobForm(FlaskForm):
submit = SubmitField() submit = SubmitField()
title = StringField('Title', validators=[DataRequired(), Length(1, 32)]) title = StringField('Title', validators=[DataRequired(), Length(1, 32)])
files = MultipleFileField('Files', validators=[DataRequired()]) files = MultipleFileField('Files', validators=[DataRequired()])
version = SelectField('Version', version = SelectField('Version', choices=[('latest', 'Latest')],
choices=[('latest', 'Latest')],
validators=[DataRequired()]) validators=[DataRequired()])
def validate_files(form, field): def validate_files(form, field):

View File

@ -41,8 +41,8 @@ def service(service):
service_args.append('--check-encoding') service_args.append('--check-encoding')
if service == 'ocr': if service == 'ocr':
service_args.append('-l {}'.format(add_job_form.language.data)) service_args.append('-l {}'.format(add_job_form.language.data))
if not add_job_form.binarization.data: if add_job_form.binarization.data:
service_args.append('--skip-binarisation') service_args.append('--binarize')
job = Job(creator=current_user, job = Job(creator=current_user,
description=add_job_form.description.data, description=add_job_form.description.data,
mem_mb=SERVICES[service]['resources']['mem_mb'], mem_mb=SERVICES[service]['resources']['mem_mb'],

View File

@ -53,7 +53,7 @@
<div class="file-field input-field"> <div class="file-field input-field">
<div class="btn"> <div class="btn">
<span>{{ add_job_form.files.label.text }}</span> <span>{{ add_job_form.files.label.text }}</span>
{{ add_job_form.files(accept='application/pdf, image/tiff') }} {{ add_job_form.files(accept='application/pdf') }}
</div> </div>
<div class="file-path-wrapper"> <div class="file-path-wrapper">
<input class="file-path validate" type="text"> <input class="file-path validate" type="text">