mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +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()])
|
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):
|
||||||
|
@ -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'],
|
||||||
|
@ -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">
|
||||||
|
Loading…
Reference in New Issue
Block a user