mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Add changes for new OCR and NLP Pipelines
This commit is contained in:
parent
498defa386
commit
9da08508c0
@ -21,9 +21,7 @@ class AddNLPJobForm(FlaskForm):
|
||||
validators=[DataRequired()])
|
||||
submit = SubmitField()
|
||||
title = StringField('Title', validators=[DataRequired(), Length(1, 32)])
|
||||
version = SelectField('Version',
|
||||
choices=[('2.2.0', 'Latest (2.2.0)'),
|
||||
('2.2.0', '2.2.0')],
|
||||
version = SelectField('Version', choices=[('latest', 'Latest')],
|
||||
validators=[DataRequired()])
|
||||
check_encoding = BooleanField('Check encoding')
|
||||
|
||||
@ -54,15 +52,14 @@ class AddOCRJobForm(FlaskForm):
|
||||
split = BooleanField('Split')
|
||||
submit = SubmitField()
|
||||
title = StringField('Title', validators=[DataRequired(), Length(1, 32)])
|
||||
version = SelectField('Version',
|
||||
choices=[('latest', 'Latest')],
|
||||
version = SelectField('Version', choices=[('latest', 'Latest')],
|
||||
validators=[DataRequired()])
|
||||
|
||||
def validate_files(form, field):
|
||||
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 '
|
||||
'extension: .pdf | .tif | .tiff')
|
||||
'extension: .pdf')
|
||||
|
||||
|
||||
class AddSetupFilesJobForm(FlaskForm):
|
||||
@ -71,8 +68,7 @@ class AddSetupFilesJobForm(FlaskForm):
|
||||
submit = SubmitField()
|
||||
title = StringField('Title', validators=[DataRequired(), Length(1, 32)])
|
||||
files = MultipleFileField('Files', validators=[DataRequired()])
|
||||
version = SelectField('Version',
|
||||
choices=[('latest', 'Latest')],
|
||||
version = SelectField('Version', choices=[('latest', 'Latest')],
|
||||
validators=[DataRequired()])
|
||||
|
||||
def validate_files(form, field):
|
||||
|
@ -41,8 +41,8 @@ def service(service):
|
||||
service_args.append('--check-encoding')
|
||||
if service == 'ocr':
|
||||
service_args.append('-l {}'.format(add_job_form.language.data))
|
||||
if not add_job_form.binarization.data:
|
||||
service_args.append('--skip-binarisation')
|
||||
if add_job_form.binarization.data:
|
||||
service_args.append('--binarize')
|
||||
job = Job(creator=current_user,
|
||||
description=add_job_form.description.data,
|
||||
mem_mb=SERVICES[service]['resources']['mem_mb'],
|
||||
|
@ -53,7 +53,7 @@
|
||||
<div class="file-field input-field">
|
||||
<div class="btn">
|
||||
<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 class="file-path-wrapper">
|
||||
<input class="file-path validate" type="text">
|
||||
|
Loading…
Reference in New Issue
Block a user