mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Add form and service
This commit is contained in:
		@@ -65,3 +65,16 @@ class AddOCRJobForm(FlaskForm):
 | 
			
		||||
                    'File does not have an approved extension: '
 | 
			
		||||
                    '.pdf | .tif | .tiff'
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AddMergeImagesJobForm(FlaskForm):
 | 
			
		||||
    files = MultipleFileField('Files', validators=[DataRequired()])
 | 
			
		||||
 | 
			
		||||
    def validate_files(form, filed):
 | 
			
		||||
        for file in field.data:
 | 
			
		||||
            if not file.filename.lower().endswith(('.jpeg', '.jpg', '.png',
 | 
			
		||||
                                                   '.tiff', '.tif')):
 | 
			
		||||
                raise ValidationError(
 | 
			
		||||
                    'File does not have an approved extension: '
 | 
			
		||||
                    '.jpeg | .jpg | .png | .tiff | .tif'
 | 
			
		||||
                )
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
from app import db
 | 
			
		||||
from app.jobs.forms import AddNLPJobForm, AddOCRJobForm
 | 
			
		||||
from app.jobs.forms import AddNLPJobForm, AddOCRJobForm, AddMergeImagesJobForm
 | 
			
		||||
from app.models import Job, JobInput
 | 
			
		||||
from flask import (abort, current_app, flash, make_response, render_template,
 | 
			
		||||
                   url_for)
 | 
			
		||||
@@ -10,7 +10,10 @@ import json
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SERVICES = {'nlp': {'name': 'Natural Language Processing',
 | 
			
		||||
SERVICES = {'merge_images': {'name': 'Merge Images',
 | 
			
		||||
                             'resources': {'mem_mb': 4096, 'n_cores': 4},
 | 
			
		||||
                             'add_job_form': AddMergeImagesJobForm},
 | 
			
		||||
            'nlp': {'name': 'Natural Language Processing',
 | 
			
		||||
                    'resources': {'mem_mb': 4096, 'n_cores': 2},
 | 
			
		||||
                    'add_job_form': AddNLPJobForm},
 | 
			
		||||
            'ocr': {'name': 'Optical Character Recognition',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user