fixed memes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-10-03 14:42:44 +02:00
parent e819dcb26e
commit 8ed165a348
2 changed files with 30 additions and 14 deletions

View File

@@ -17,6 +17,9 @@ class SVMView(FlaskView):
aimodel_schema = AIModelSchema(many=False)
info_schema = InfoSchema(many=False)
MODEL_DIRECTORY = "model/"
MEANS_DIRECTORY = "means/"
@multipart_required
def post(self):
@@ -65,13 +68,13 @@ class SVMView(FlaskView):
# Because of pyAudiomeme the files already saved, so we just use the file uploader functions
storage.connection.fput_object(
current_app.config['MINIO_SVM_BUCKET_NAME'],
"model/" + str(info['id']),
self.MODEL_DIRECTORY + str(info['id']),
temp_model_filename
)
storage.connection.fput_object(
current_app.config['MINIO_SVM_BUCKET_NAME'],
"means/" + str(info['id']),
self.MEANS_DIRECTORY + str(info['id']),
temp_means_filename
)
@@ -104,8 +107,8 @@ class SVMView(FlaskView):
else:
m = AIModel.query.filter_by(type=AIModelType.svm, id=id_).first_or_404()
storage.connection.remove_object(current_app.config['MINIO_SVM_BUCKET_NAME'], "means/" + str(m.id))
storage.connection.remove_object(current_app.config['MINIO_SVM_BUCKET_NAME'], "model/" + str(m.id))
storage.connection.remove_object(current_app.config['MINIO_SVM_BUCKET_NAME'], self.MEANS_DIRECTORY + str(m.id))
storage.connection.remove_object(current_app.config['MINIO_SVM_BUCKET_NAME'], self.MODEL_DIRECTORY + str(m.id))
db.session.delete(m)
db.session.commit()
@@ -123,9 +126,9 @@ class SVMView(FlaskView):
m = AIModel.query.filter_by(type=AIModelType.svm, id=id_).first_or_404()
if "means" in request.args:
path = "means/" + str(m.id)
path = self.MEANS_DIRECTORY + str(m.id)
else:
path = "model/" + str(m.id)
path = self.MODEL_DIRECTORY + str(m.id)
try:
data = storage.connection.get_object(current_app.config['MINIO_SVM_BUCKET_NAME'], path)