|  | @@ -1,12 +1,17 @@
 | 
	
		
			
				|  |  |  """
 | 
	
		
			
				|  |  |  @author: luojunhui
 | 
	
		
			
				|  |  |  """
 | 
	
		
			
				|  |  | +import jieba
 | 
	
		
			
				|  |  |  from quart import Quart
 | 
	
		
			
				|  |  | +from text2vec import Word2Vec
 | 
	
		
			
				|  |  |  from similarities import BertSimilarity
 | 
	
		
			
				|  |  |  from routes import AlgRoutes
 | 
	
		
			
				|  |  |  from applications import AsyncMySQLClient
 | 
	
		
			
				|  |  |  from applications.embedding_manager import EmbeddingManager
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +jieba.initialize()
 | 
	
		
			
				|  |  | +print("jieba初始化成功")
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  app = Quart(__name__)
 | 
	
		
			
				|  |  |  AsyncMySQL = AsyncMySQLClient(app)
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -16,10 +21,12 @@ async def init():
 | 
	
		
			
				|  |  |      初始化模型
 | 
	
		
			
				|  |  |      """
 | 
	
		
			
				|  |  |      await AsyncMySQL.init_pool()
 | 
	
		
			
				|  |  | -    model = BertSimilarity(model_name_or_path="BAAI/bge-large-zh-v1.5")
 | 
	
		
			
				|  |  | -    embedding_manager = EmbeddingManager(model)
 | 
	
		
			
				|  |  | -    print("模型加载成功")
 | 
	
		
			
				|  |  | -    app_routes = AlgRoutes(AsyncMySQL, model, embedding_manager)
 | 
	
		
			
				|  |  | +    similarity_model = BertSimilarity(model_name_or_path="BAAI/bge-large-zh-v1.5")
 | 
	
		
			
				|  |  | +    embedding_manager = EmbeddingManager(similarity_model)
 | 
	
		
			
				|  |  | +    print("相似度模型加载成功")
 | 
	
		
			
				|  |  | +    word2vec_model = Word2Vec("lili666/text2vec-word2vec-tencent-chinese")
 | 
	
		
			
				|  |  | +    print("词向量模型加载成功")
 | 
	
		
			
				|  |  | +    app_routes = AlgRoutes(AsyncMySQL, similarity_model, word2vec_model, embedding_manager)
 | 
	
		
			
				|  |  |      app.register_blueprint(app_routes)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |