mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-04-06 01:04:22 +00:00
Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development
This commit is contained in:
commit
1bdae333b7
@ -1,5 +1,6 @@
|
|||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
from wtforms import StringField, PasswordField, BooleanField, SubmitField, ValidationError, TextAreaField
|
from wtforms import (StringField, PasswordField, BooleanField, SubmitField,
|
||||||
|
ValidationError)
|
||||||
from wtforms.validators import DataRequired, Length, Email, Regexp, EqualTo
|
from wtforms.validators import DataRequired, Length, Email, Regexp, EqualTo
|
||||||
from ..models import User
|
from ..models import User
|
||||||
|
|
||||||
@ -13,13 +14,20 @@ class LoginForm(FlaskForm):
|
|||||||
|
|
||||||
class RegistrationForm(FlaskForm):
|
class RegistrationForm(FlaskForm):
|
||||||
email = StringField('Email', validators=[DataRequired(), Email()])
|
email = StringField('Email', validators=[DataRequired(), Email()])
|
||||||
username = StringField('Username', validators=[
|
username = StringField(
|
||||||
DataRequired(), Length(1, 64),
|
'Username',
|
||||||
Regexp('^[A-Za-z][A-Za-z0-9_.]*$', 0,
|
validators=[DataRequired(),
|
||||||
'Usernames must have only letters, numbers, dots or '
|
Length(1, 64),
|
||||||
'underscores')])
|
Regexp('^[A-Za-z][A-Za-z0-9_.]*$',
|
||||||
password = PasswordField('Password', validators=[
|
0,
|
||||||
DataRequired(), EqualTo('password2', message='Passwords must match.')])
|
'Usernames must have only letters, numbers, dots '
|
||||||
|
'or underscores')]
|
||||||
|
)
|
||||||
|
password = PasswordField(
|
||||||
|
'Password',
|
||||||
|
validators=[DataRequired(),
|
||||||
|
EqualTo('password2', message='Passwords must match.')]
|
||||||
|
)
|
||||||
password2 = PasswordField('Confirm password', validators=[DataRequired()])
|
password2 = PasswordField('Confirm password', validators=[DataRequired()])
|
||||||
submit = SubmitField('Register')
|
submit = SubmitField('Register')
|
||||||
|
|
||||||
@ -79,8 +87,8 @@ class ChangePasswordForm(FlaskForm):
|
|||||||
|
|
||||||
|
|
||||||
class EditProfileForm(FlaskForm):
|
class EditProfileForm(FlaskForm):
|
||||||
email = StringField('Change Email', validators=[Length(0, 64),
|
email = StringField('Change Email',
|
||||||
DataRequired()])
|
validators=[Length(0, 254), DataRequired()])
|
||||||
submit = SubmitField('Change Email')
|
submit = SubmitField('Change Email')
|
||||||
|
|
||||||
def __init__(self, user, *args, **kwargs):
|
def __init__(self, user, *args, **kwargs):
|
||||||
|
@ -110,7 +110,7 @@ class User(UserMixin, db.Model):
|
|||||||
# Primary key
|
# Primary key
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
confirmed = db.Column(db.Boolean, default=False)
|
confirmed = db.Column(db.Boolean, default=False)
|
||||||
email = db.Column(db.String(64), unique=True, index=True)
|
email = db.Column(db.String(254), unique=True, index=True)
|
||||||
password_hash = db.Column(db.String(128))
|
password_hash = db.Column(db.String(128))
|
||||||
registration_date = db.Column(db.DateTime(), default=datetime.utcnow)
|
registration_date = db.Column(db.DateTime(), default=datetime.utcnow)
|
||||||
role_id = db.Column(db.Integer, db.ForeignKey('roles.id'))
|
role_id = db.Column(db.Integer, db.ForeignKey('roles.id'))
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from flask_wtf import FlaskForm
|
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
|
from wtforms.validators import DataRequired, Length
|
||||||
|
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ class NewNLPJobForm(FlaskForm):
|
|||||||
|
|
||||||
|
|
||||||
class NewOCRJobForm(FlaskForm):
|
class NewOCRJobForm(FlaskForm):
|
||||||
|
binarization = BooleanField('Binarazation')
|
||||||
description = StringField('Description',
|
description = StringField('Description',
|
||||||
validators=[DataRequired(), Length(1, 255)])
|
validators=[DataRequired(), Length(1, 255)])
|
||||||
files = MultipleFileField('Files', validators=[DataRequired()])
|
files = MultipleFileField('Files', validators=[DataRequired()])
|
||||||
@ -49,6 +51,7 @@ class NewOCRJobForm(FlaskForm):
|
|||||||
('por', 'Portuguese'),
|
('por', 'Portuguese'),
|
||||||
('spa', 'Spanish; Castilian')],
|
('spa', 'Spanish; Castilian')],
|
||||||
validators=[DataRequired()])
|
validators=[DataRequired()])
|
||||||
|
split = BooleanField('Split')
|
||||||
submit = SubmitField('Submit')
|
submit = SubmitField('Submit')
|
||||||
title = StringField('Title', validators=[DataRequired(), Length(1, 32)])
|
title = StringField('Title', validators=[DataRequired(), Length(1, 32)])
|
||||||
version = SelectField('Version',
|
version = SelectField('Version',
|
||||||
|
@ -62,9 +62,13 @@ def ocr():
|
|||||||
mem_mb=8192,
|
mem_mb=8192,
|
||||||
n_cores=4,
|
n_cores=4,
|
||||||
service='ocr',
|
service='ocr',
|
||||||
service_args=json.dumps([
|
service_args=json.dumps(
|
||||||
'-l {}'.format(new_ocr_job_form.language.data),
|
[
|
||||||
'--skip-binarisation']),
|
'-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,
|
service_version=new_ocr_job_form.version.data,
|
||||||
status='preparing',
|
status='preparing',
|
||||||
title=new_ocr_job_form.title.data)
|
title=new_ocr_job_form.title.data)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">person</i>
|
<i class="material-icons prefix">person</i>
|
||||||
{{ form.username(class='validate') }}
|
{{ form.username(class='validate', data_length='64') }}
|
||||||
{{ form.username.label }}
|
{{ form.username.label }}
|
||||||
{% for error in form.username.errors %}
|
{% for error in form.username.errors %}
|
||||||
<span class="helper-text red-text">{{ error }}</span>
|
<span class="helper-text red-text">{{ error }}</span>
|
||||||
|
@ -94,7 +94,7 @@
|
|||||||
<div class="col s12 m4">
|
<div class="col s12 m4">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">title</i>
|
<i class="material-icons prefix">title</i>
|
||||||
{{ create_corpus_form.title() }}
|
{{ create_corpus_form.title(data_length='32') }}
|
||||||
{{ create_corpus_form.title.label }}
|
{{ create_corpus_form.title.label }}
|
||||||
{% for error in create_corpus_form.title.errors %}
|
{% for error in create_corpus_form.title.errors %}
|
||||||
<span class="helper-text red-text">{{ error }}</span>
|
<span class="helper-text red-text">{{ error }}</span>
|
||||||
@ -104,7 +104,7 @@
|
|||||||
<div class="col s12 m8">
|
<div class="col s12 m8">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">description</i>
|
<i class="material-icons prefix">description</i>
|
||||||
{{ create_corpus_form.description() }}
|
{{ create_corpus_form.description(data_length='255') }}
|
||||||
{{ create_corpus_form.description.label }}
|
{{ create_corpus_form.description.label }}
|
||||||
{% for error in create_corpus_form.description.errors %}
|
{% for error in create_corpus_form.description.errors %}
|
||||||
<span class="helper-text red-text">{{ error }}</span>
|
<span class="helper-text red-text">{{ error }}</span>
|
||||||
|
@ -88,8 +88,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col s12"></div>
|
||||||
<div class="row">
|
|
||||||
<div class="col s12 m6">
|
<div class="col s12 m6">
|
||||||
<div class="file-field input-field">
|
<div class="file-field input-field">
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
@ -114,6 +113,23 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col s12"></div>
|
||||||
|
<div class="col s12">
|
||||||
|
<div class="switch right-align">
|
||||||
|
<label>
|
||||||
|
Perform binarization
|
||||||
|
{{ new_ocr_job_form.binarization() }}
|
||||||
|
<span class="lever"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="switch right-align">
|
||||||
|
<label>
|
||||||
|
Split pages in half
|
||||||
|
<input type="checkbox" disabled>
|
||||||
|
<span class="lever"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action right-align">
|
<div class="card-action right-align">
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""empty message
|
"""empty message
|
||||||
|
|
||||||
Revision ID: 3ca96d906e29
|
Revision ID: 3ca96d906e29
|
||||||
Revises:
|
Revises:
|
||||||
Create Date: 2019-09-05 11:43:41.634109
|
Create Date: 2019-09-05 11:43:41.634109
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -30,7 +30,7 @@ def upgrade():
|
|||||||
op.create_table('users',
|
op.create_table('users',
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('confirmed', sa.Boolean(), nullable=True),
|
sa.Column('confirmed', sa.Boolean(), nullable=True),
|
||||||
sa.Column('email', sa.String(length=64), nullable=True),
|
sa.Column('email', sa.String(length=254), nullable=True),
|
||||||
sa.Column('password_hash', sa.String(length=128), nullable=True),
|
sa.Column('password_hash', sa.String(length=128), nullable=True),
|
||||||
sa.Column('registration_date', sa.DateTime(), nullable=True),
|
sa.Column('registration_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('role_id', sa.Integer(), nullable=True),
|
sa.Column('role_id', sa.Integer(), nullable=True),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user