mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-10-31 02:32:45 +00:00 
			
		
		
		
	Add switch for binarization
This commit is contained in:
		| @@ -1,5 +1,6 @@ | ||||
| from flask_wtf import FlaskForm | ||||
| from wtforms import MultipleFileField, SelectField, StringField, SubmitField, ValidationError | ||||
| from wtforms import (BooleanField, MultipleFileField, SelectField, StringField, | ||||
|                      SubmitField, ValidationError) | ||||
| from wtforms.validators import DataRequired, Length | ||||
|  | ||||
|  | ||||
| @@ -34,6 +35,7 @@ class NewNLPJobForm(FlaskForm): | ||||
|  | ||||
|  | ||||
| class NewOCRJobForm(FlaskForm): | ||||
|     binarization = BooleanField('Binarazation') | ||||
|     description = StringField('Description', | ||||
|                               validators=[DataRequired(), Length(1, 255)]) | ||||
|     files = MultipleFileField('Files', validators=[DataRequired()]) | ||||
| @@ -49,6 +51,7 @@ class NewOCRJobForm(FlaskForm): | ||||
|                                     ('por', 'Portuguese'), | ||||
|                                     ('spa', 'Spanish; Castilian')], | ||||
|                            validators=[DataRequired()]) | ||||
|     split = BooleanField('Split') | ||||
|     submit = SubmitField('Submit') | ||||
|     title = StringField('Title', validators=[DataRequired(), Length(1, 32)]) | ||||
|     version = SelectField('Version', | ||||
|   | ||||
| @@ -62,9 +62,13 @@ def ocr(): | ||||
|                       mem_mb=8192, | ||||
|                       n_cores=4, | ||||
|                       service='ocr', | ||||
|                       service_args=json.dumps([ | ||||
|                         '-l {}'.format(new_ocr_job_form.language.data), | ||||
|                         '--skip-binarisation']), | ||||
|                       service_args=json.dumps( | ||||
|                          [ | ||||
|                              '-l {}'.format(new_ocr_job_form.language.data), | ||||
|                              '' if new_ocr_job_form.binarization.data | ||||
|                              else '--skip-binarisation' | ||||
|                          ] | ||||
|                       ), | ||||
|                       service_version=new_ocr_job_form.version.data, | ||||
|                       status='preparing', | ||||
|                       title=new_ocr_job_form.title.data) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user