Add transkribus models

This commit is contained in:
Patrick Jentsch 2022-04-25 16:09:06 +02:00
parent d076b25189
commit d68f30db8b
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,6 @@
from app import db, login from app import db, login
from app.converters.vrt import normalize_vrt_file from app.converters.vrt import normalize_vrt_file
from app.sqlalchemy_custom_types import ContainerColumn, IntEnumColumn from app.sqlalchemy_type_decorators import ContainerColumn, IntEnumColumn
from datetime import datetime, timedelta from datetime import datetime, timedelta
from enum import IntEnum from enum import IntEnum
from flask import current_app, url_for from flask import current_app, url_for
@ -461,10 +461,14 @@ class TranskribusHTRModel(HashidMixin, db.Model):
@staticmethod @staticmethod
def insert_defaults(): def insert_defaults():
user = User.query.filter_by(username='nopaque').first() user = User.query.filter_by(username='nopaque').first()
# models = [
# m for m in TRANSKRIBUS_HTR_MODELS if True
# and 'creator' in m and m['creator'] == 'Transkribus Team'
# and 'docType' in m and m['docType'] == 'handwritten'
# ]
models = [ models = [
m for m in TRANSKRIBUS_HTR_MODELS if True m for m in TRANSKRIBUS_HTR_MODELS
and 'creator' in m and m['creator'] == 'Transkribus Team' if m['modelId'] in [35909, 33744, 33597, 29820, 37789, 13685, 37855, 26124, 37738, 30919, 34763]
and 'docType' in m and m['docType'] == 'handwritten'
] ]
for m in models: for m in models:
model = TranskribusHTRModel.query.filter_by(transkribus_model_id=m['modelId']).first() # noqa model = TranskribusHTRModel.query.filter_by(transkribus_model_id=m['modelId']).first() # noqa