From aaad0dc7c230656aaad7bc014f74d4108e2a4ab9 Mon Sep 17 00:00:00 2001 From: marioggil Date: Wed, 11 Oct 2023 10:32:32 -0500 Subject: [PATCH] feat: Version in api --- main.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 61b6f1d..7e5caf1 100644 --- a/main.py +++ b/main.py @@ -23,7 +23,8 @@ from unidecode import unidecode from nltk.corpus import stopwords #from cleantext import clean import re - +model="embeddings/all-mpnet-base-v2" +entrenamiento="V0.0" class CustomEmbedding(Embeddings, BaseModel,): """embedding model with preprocessing""" def _get_embedding(self,text) -> List[float]: @@ -123,7 +124,7 @@ def makeFaissdb(documents,folder_path,embedding): return db #llm,emb=loadModels() -model="embeddings/all-mpnet-base-v2" + documents,documents2=loadCopysAndData() emb=loadmodelEmb(model_name = model) emb2=CustomEmbedding() @@ -160,7 +161,7 @@ def FinderDbs(query,dbs,filtred=False,th=1.2): def QARequest(Pregunta,filtred=False): query = Pregunta AllData=FinderDbs(query,[db2],filtred) - + versionL="_".join([model,entrenamiento]) if AllData: import markdown AllData = list(AllData) @@ -180,8 +181,9 @@ def QARequest(Pregunta,filtred=False): #lista = lista + '' AllData[0] = lista + - return id, dis + return id, dis,versionL @@ -198,8 +200,8 @@ with gr.Blocks() as demo: Respuesta = gr.Textbox(label="Respuesta") id = gr.Textbox(label="id") metrica=gr.Textbox(label="metrica") - # gr.Markdown("Respuestas para orca desde los names") - # Respuesta2 = gr.Textbox(label="Respuesta2") + + version = gr.Textbox(label="version") # id2 = gr.Textbox(label="id2") # metrica2=gr.Textbox(label="metrica2") # gr.Markdown("Respuestas para hf desde los names") @@ -208,7 +210,7 @@ with gr.Blocks() as demo: # metrica3=gr.Textbox(label="metrica3") Enviar_btn = gr.Button("Responder") - Enviar_btn.click(fn=QARequest, inputs=[Pregunta,filtred], outputs=[id,metrica], api_name="api_angela") # + Enviar_btn.click(fn=QARequest, inputs=[Pregunta,filtred], outputs=[id,metrica,version], api_name="api_angela") # #demo.launch(root_path="angela") #