From 87cd0f780f48748271d670eba9626cfff17328f7 Mon Sep 17 00:00:00 2001 From: Mario Gonzalez Gil Date: Mon, 4 Dec 2023 20:35:11 +0100 Subject: [PATCH] mod base code in server --- main.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index f4271e5..2f745c9 100644 --- a/main.py +++ b/main.py @@ -24,8 +24,11 @@ from nltk.corpus import stopwords from typing import Optional #from cleantext import clean import re +from langid.langid import LanguageIdentifier +from langid.langid import model as modellangid +import time model="Modelo_embedding_Mexico_Puebla/all-mpnet-base-v2/model" -entrenamiento="V1.2" +entrenamiento="V1.3" @@ -128,7 +131,7 @@ emb2=CustomEmbedding() db=makeFaissdb(documents,"Copies3",emb2) db2=makeFaissdb(documents2,"Intentionality3",emb2) #db3=makeFaissdb(documents2,"nameshf",hf) - +identifier = LanguageIdentifier.from_modelstring(modellangid, norm_probs=True) @@ -179,7 +182,14 @@ def calculate_api(response: Response): filtred = -9.0 AllData=FinderDbs(query,[db2,db],filtred) + print(AllData) versionL="_".join([model,entrenamiento]) + #tt=time.time() + #if identifier.classify(query)[1]< 0.3: + #print(identifier.classify(query)) + #print(time.time()-tt) + #return {"ids": [],"DC":[],"modelo":versionL} + #print(time.time()-tt) if AllData: AllData = list(AllData) dis=[]