routes.py 740 B

123456789101112131415161718192021222324252627282930313233343536
  1. """
  2. @author: luojunhui
  3. """
  4. from quart import Blueprint, jsonify, request
  5. from applications.functions import ParamProcess
  6. video_score_blueprint = Blueprint('light_gbm_score', __name__)
  7. @video_score_blueprint.route('/hello')
  8. async def hello():
  9. """
  10. Hello World Test
  11. :return:
  12. """
  13. return jsonify({'message': 'Hello, World!'})
  14. @video_score_blueprint.route('/lightgbm_score', methods=['POST'])
  15. async def post_data():
  16. """
  17. 请求接口代码
  18. :return:
  19. """
  20. p = ParamProcess()
  21. data = await request.get_json()
  22. processed_data = await p.process(data)
  23. if processed_data:
  24. obj = processed_data[0]
  25. else:
  26. obj = None
  27. r = {
  28. 'quality_score': obj
  29. }
  30. return jsonify(r)