浏览代码

初始化

罗俊辉 1 年之前
父节点
当前提交
bd9f62e9fb
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      async_app.py

+ 10 - 0
async_app.py

@@ -1,6 +1,7 @@
 """
 @author: luojunhui
 """
+import jieba
 from quart import Quart
 from applications.routes import video_score_blueprint
 from applications.model_init import Models
@@ -21,5 +22,14 @@ async def before_serving():
     Models()
 
 
+@app.before_serving
+async def preload_jieba():
+    """
+    异步预加载jieba词典
+    :return:
+    """
+    jieba.initialize()
+
+
 if __name__ == '__main__':
     app.run(debug=True)