Add version field for ocr job

This commit is contained in:
Patrick Jentsch 2019-08-05 12:25:51 +02:00
parent a1be95ff68
commit f506a562cd
3 changed files with 57 additions and 29 deletions

View File

@ -29,6 +29,13 @@ class NewOCRJobForm(FlaskForm):
'Title',
validators=[DataRequired(), Length(1, 32)]
)
version = SelectField(
'Version',
choices=[('', 'Choose your option'),
('latest', 'Latest'),
],
validators=[DataRequired()]
)
def validate_files(form, field):
for file in field.data:
@ -62,6 +69,13 @@ class NewNLPJobForm(FlaskForm):
'Title',
validators=[DataRequired(), Length(1, 32)]
)
version = SelectField(
'Version',
choices=[('', 'Choose your option'),
('latest', 'Latest'),
],
validators=[DataRequired()]
)
def validate_files(form, field):
for file in field.data:

View File

@ -28,7 +28,7 @@ def ocr():
'requested_memory': 2048,
'service': 'ocr',
'service_args': {'lang': new_ocr_job_form.language.data,
'version': 'latest'
'version': new_ocr_job_form.version.data
},
'status': 'queued'
}

View File

@ -78,8 +78,8 @@
<div class="col s12">
<div class="card">
<div class="card-content">
<form method="POST" enctype="multipart/form-data">
<form method="POST" enctype="multipart/form-data">
<div class="card-content">
{{ new_ocr_job_form.hidden_tag() }}
<div class="row">
<div class="col s12 m4">
@ -92,30 +92,6 @@
{% endfor %}
</div>
</div>
<div class="col s12 m8">
<div class="input-field">
<i class="material-icons prefix">description</i>
{{ new_ocr_job_form.description() }}
{{ new_ocr_job_form.description.label }}
{% for error in new_ocr_job_form.description.errors %}
<span class="helper-text red-text">{{ error }}</span>
{% endfor %}
</div>
</div>
<div class="col s12 m8">
<div class="file-field input-field">
<div class="btn">
<span>{{ new_ocr_job_form.files.label.text }}</span>
{{ new_ocr_job_form.files(accept='application/pdf, image/tiff') }}
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
</div>
{% for error in new_ocr_job_form.files.errors %}
<span class="helper-text red-text">{{ error }}</span>
{% endfor %}
</div>
</div>
<div class="col s12 m4">
<div class="input-field">
<i class="material-icons prefix">language</i>
@ -126,10 +102,48 @@
{% endfor %}
</div>
</div>
<div class="col s12 m4">
<div class="input-field">
<i class="material-icons prefix">language</i>
{{ new_ocr_job_form.version() }}
{{ new_ocr_job_form.version.label }}
{% for error in new_ocr_job_form.version.errors %}
<span class="helper-text red-text">{{ error }}</span>
{% endfor %}
</div>
</div>
</div>
<div class="row">
<div class="col s12 m6">
<div class="file-field input-field">
<div class="btn">
<span>{{ new_ocr_job_form.files.label.text }}</span>
{{ new_ocr_job_form.files(accept='application/pdf, image/tiff') }}
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
</div>
{% for error in new_ocr_job_form.files.errors %}
<span class="helper-text red-text">{{ error }}</span>
{% endfor %}
</div>
</div>
<div class="col s12 m6">
<div class="input-field">
<i class="material-icons prefix">description</i>
{{ new_ocr_job_form.description() }}
{{ new_ocr_job_form.description.label }}
{% for error in new_ocr_job_form.description.errors %}
<span class="helper-text red-text">{{ error }}</span>
{% endfor %}
</div>
</div>
</div>
</div>
<div class="card-action right-align">
{{ new_ocr_job_form.submit(class='btn') }}
</form>
</div>
</div>
</form>
</div>
</div>
{% endblock %}