Feat: custom url and with fast api
This commit is contained in:
parent
1ef27e7586
commit
9cb1b02087
18
FindinDB.py
18
FindinDB.py
|
@ -21,6 +21,7 @@ from langchain.embeddings import HuggingFaceEmbeddings
|
|||
import pandas as pd
|
||||
import sqlite3
|
||||
from sentence_transformers import SentenceTransformer
|
||||
from fastapi import FastAPI
|
||||
#from cleantext import clean
|
||||
import re
|
||||
model_name = 'hiiamsid/sentence_similarity_spanish_es'
|
||||
|
@ -32,6 +33,13 @@ hf = HuggingFaceEmbeddings(
|
|||
encode_kwargs=encode_kwargs
|
||||
)
|
||||
|
||||
CUSTOM_PATH = "/angela"
|
||||
app = FastAPI()
|
||||
|
||||
@app.get("/")
|
||||
def read_main():
|
||||
return {"message": "This is your main app"}
|
||||
|
||||
|
||||
def loadModels():
|
||||
#model = GPT4All("orca-mini-3b.ggmlv3.q4_0.bin")
|
||||
|
@ -124,7 +132,13 @@ with gr.Blocks() as demo:
|
|||
# metrica3=gr.Textbox(label="metrica3")
|
||||
Enviar_btn = gr.Button("Responder")
|
||||
|
||||
Enviar_btn.click(fn=QARequest, inputs=[Pregunta,filtred], outputs=[Respuesta,id], api_name="Angela") #
|
||||
Enviar_btn.click(fn=QARequest, inputs=[Pregunta,filtred], outputs=[Respuesta,id], api_name="api_angela") #
|
||||
|
||||
demo.launch() #
|
||||
#demo.launch(root_path="angela") #
|
||||
|
||||
gradio_app = gr.routes.App.create_app(demo)
|
||||
|
||||
app.mount(CUSTOM_PATH, gradio_app)
|
||||
|
||||
#app = demo.mount_gradio_app(app, io, path=CUSTOM_PATH)
|
||||
|
||||
|
|
Loading…
Reference in New Issue