mod base code in server

This commit is contained in:
Mario Gonzalez Gil 2023-12-04 20:35:11 +01:00
parent 9a9597ec31
commit 87cd0f780f
1 changed files with 12 additions and 2 deletions

14
main.py
View File

@ -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=[]