Added files field to model info
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
from flask import jsonify, abort, request
|
||||
from flask import jsonify, abort, request, url_for
|
||||
from flask_classful import FlaskView, route
|
||||
from marshmallow import ValidationError
|
||||
|
||||
@@ -47,7 +47,26 @@ class RootView(FlaskView):
|
||||
else:
|
||||
m = AIModel.query.filter_by(type=aimodel_type, id=id_).first_or_404()
|
||||
|
||||
return jsonify(self.aimodel_schema.dump(m))
|
||||
# Append download links
|
||||
details = self.aimodel_schema.dump(m)
|
||||
|
||||
# Vagy ez, vagy visszateszem a saját view-jébe és duplikálva lesz az egész
|
||||
if aimodel_type == AIModelType.cnn:
|
||||
details.update({
|
||||
"files": {
|
||||
"model": url_for("CNNView:get_file", id_=m.id),
|
||||
"weights": url_for("CNNView:get_file", id_=m.id, weights=''),
|
||||
}
|
||||
})
|
||||
elif aimodel_type == AIModelType.svm:
|
||||
details.update({
|
||||
"files": {
|
||||
"model": url_for("SVMView:get_file", id_=m.id),
|
||||
"means": url_for("SVMView:get_file", id_=m.id, means=''),
|
||||
}
|
||||
})
|
||||
|
||||
return jsonify(details)
|
||||
|
||||
@json_required
|
||||
@route('/<type_>/$default', methods=['PUT'])
|
||||
|
||||
Reference in New Issue
Block a user