From 8115c8b755d11db30f87e6689e01282f523bac88 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Wed, 11 Sep 2019 15:40:37 +0200
Subject: [PATCH] Add Version selection to NLP
---
app/logs/main.log | 4 ++--
app/services/forms.py | 13 +++++--------
app/services/views.py | 20 +++++++++-----------
3 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/app/logs/main.log b/app/logs/main.log
index 0d289055..d67e6687 100644
--- a/app/logs/main.log
+++ b/app/logs/main.log
@@ -1,2 +1,2 @@
-2019-09-11 12:48:21 - WARNING - werkzeug - _internal.py - 122 - * Debugger is active!
-2019-09-11 12:48:21 - INFO - werkzeug - _internal.py - 122 - * Debugger PIN: 140-241-697
+2019-09-11 13:24:19 - WARNING - werkzeug - _internal.py - 122 - * Debugger is active!
+2019-09-11 13:24:19 - INFO - werkzeug - _internal.py - 122 - * Debugger PIN: 269-727-944
diff --git a/app/services/forms.py b/app/services/forms.py
index 5a79f8bb..6ee5683f 100644
--- a/app/services/forms.py
+++ b/app/services/forms.py
@@ -17,8 +17,7 @@ class NewNLPJobForm(FlaskForm):
('de', 'German'),
('it', 'Italian'),
('pt', 'Portuguese'),
- ('es', 'Spanish')
- ],
+ ('es', 'Spanish')],
validators=[DataRequired()]
)
submit = SubmitField('Submit')
@@ -29,8 +28,8 @@ class NewNLPJobForm(FlaskForm):
version = SelectField(
'Version',
choices=[('', 'Choose your option'),
- ('latest', 'Latest'),
- ],
+ ('latest', 'Latest (2.1.0)'),
+ ('2.1.0', '2.1.0')],
validators=[DataRequired()]
)
@@ -60,8 +59,7 @@ class NewOCRJobForm(FlaskForm):
('frk', 'German Fraktur'),
('ita', 'Italian'),
('por', 'Portuguese'),
- ('spa', 'Spanish; Castilian')
- ],
+ ('spa', 'Spanish; Castilian')],
validators=[DataRequired()]
)
submit = SubmitField('Submit')
@@ -72,8 +70,7 @@ class NewOCRJobForm(FlaskForm):
version = SelectField(
'Version',
choices=[('', 'Choose your option'),
- ('latest', 'Latest'),
- ],
+ ('latest', 'Latest')],
validators=[DataRequired()]
)
diff --git a/app/services/views.py b/app/services/views.py
index 52c36084..7f624f7d 100644
--- a/app/services/views.py
+++ b/app/services/views.py
@@ -18,7 +18,9 @@ def nlp():
mem_mb=4096,
n_cores=2,
service='nlp',
- service_args=json.dumps(['-l {}'.format(new_nlp_job_form.language.data)]),
+ service_args=json.dumps(
+ ['-l {}'.format(new_nlp_job_form.language.data)]
+ ),
service_version=new_nlp_job_form.version.data,
status='preparing',
title=new_nlp_job_form.title.data)
@@ -45,11 +47,9 @@ def nlp():
flash('Job created!')
return redirect(url_for('services.nlp'))
- return render_template(
- 'services/nlp.html.j2',
- title='Natrual Language Processing',
- new_nlp_job_form=new_nlp_job_form
- )
+ return render_template('services/nlp.html.j2',
+ title='Natrual Language Processing',
+ new_nlp_job_form=new_nlp_job_form)
@services.route('/ocr', methods=['GET', 'POST'])
@@ -91,8 +91,6 @@ def ocr():
flash('Job created!')
return redirect(url_for('services.ocr'))
- return render_template(
- 'services/ocr.html.j2',
- title='Optical Character Recognition',
- new_ocr_job_form=new_ocr_job_form
- )
+ return render_template('services/ocr.html.j2',
+ title='Optical Character Recognition',
+ new_ocr_job_form=new_ocr_job_form)