123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- """
- @author: luojunhui
- """
- from quart import Blueprint, jsonify, request
- from .AccountArticleRank import AccountArticleRank
- from .nlpServer import NLPServer
- def AlgRoutes(mysql_client, model):
- """
- ALG ROUTES
- :return:
- """
- blueprint = Blueprint("LongArticlesAlgServer", __name__)
- @blueprint.route("/healthCheck")
- def helloFuture():
- """
- 测试服务连通性
- :return:
- """
- response = {"msg": "Hello, World! Hello, Future"}
- return jsonify(response)
- @blueprint.route("/articleRank", methods=["POST"])
- async def articleRankRoute():
- """
- 文章排序接口
- :return:
- """
- params = await request.get_json()
- AAR = AccountArticleRank(params, mysql_client=mysql_client)
- response = await AAR.deal()
- # print(response)
- return jsonify(response)
- @blueprint.route("/nlp", methods=["POST"])
- async def nlper():
- """
- nlper ma
- :return:
- """
- params = await request.get_json()
- nlpS = NLPServer(params=params, model=model)
- result = nlpS.deal()
- response = {"result": result}
- return jsonify(response)
- return blueprint
|