', methods=['GET', 'POST'])
@login_required
def service(service):
@@ -30,23 +20,26 @@ def service(service):
if service == 'corpus_analysis':
return render_template('services/{}.html.j2'.format(service),
title=SERVICES[service]['name'])
- form = SERVICES[service]['form'](prefix='add-job-form')
+ elif service == 'file-setup':
+ form = AddFileSetupJobForm(prefix='add-file-setup-job-form')
+ elif service == 'nlp':
+ form = AddNLPJobForm(prefix='add-nlp-job-form')
+ elif service == 'ocr':
+ form = AddOCRJobForm(prefix='add-ocr-job-form')
if form.is_submitted():
if not form.validate():
return make_response(form.errors, 400)
service_args = []
if service == 'nlp':
- service_args.append('-l {}'.format(form.language.data))
+ service_args.append('-l {}'.format(form.model.data))
if form.check_encoding.data:
service_args.append('--check-encoding')
if service == 'ocr':
- service_args.append('-l {}'.format(form.language.data))
+ service_args.append('-l {}'.format(form.model.data))
if form.binarization.data:
service_args.append('--binarize')
job = Job(creator=current_user,
description=form.description.data,
- mem_mb=SERVICES[service]['resources']['mem_mb'],
- n_cores=SERVICES[service]['resources']['n_cores'],
service=service, service_args=json.dumps(service_args),
service_version=form.version.data,
status='preparing', title=form.title.data)
diff --git a/web/app/templates/services/ocr.html.j2 b/web/app/templates/services/ocr.html.j2
index 09759e0c..5cb520bf 100644
--- a/web/app/templates/services/ocr.html.j2
+++ b/web/app/templates/services/ocr.html.j2
@@ -60,7 +60,7 @@
{{ wtf.render_field(form.files, accept='application/pdf', color=ocr_color_darken, placeholder='Choose your .pdf files') }}
- {{ wtf.render_field(form.language, material_icon='language') }}
+ {{ wtf.render_field(form.model, material_icon='language') }}
{{ wtf.render_field(form.version, material_icon='apps') }}