Fixed stuff
continuous-integration/drone/push Build is passing Details

- Creating a new new object when it isn't supposed
- Serializing enum field
This commit is contained in:
Pünkösd Marcell 2020-09-14 03:02:31 +02:00
parent bfe2ec8c8c
commit 7a9d098107
2 changed files with 4 additions and 3 deletions

View File

@ -1,13 +1,16 @@
#!/usr/bin/env python3
from marshmallow import fields
from marshmallow_sqlalchemy import ModelSchema
from model import AIModel
from marshmallow_enum import EnumField
from model import AIModel, AIModelType
class AIModelSchema(ModelSchema):
default = fields.Method("boolize_default", dump_only=True)
type = EnumField(AIModelType)
def boolize_default(self, ai_model) -> bool:
return bool(ai_model.default)

View File

@ -60,8 +60,6 @@ class CNNView(FlaskView):
storage.connection.put_object(current_app.config['MINIO_CNN_BUCKET_NAME'], "weights/" + str(m.id), weights_file,
weights_file.content_length, content_type=weights_file.content_type)
m = AIModel(id=info['id'], type=AIModelType.CNN)
db.session.add(m)
db.session.commit()