update cli_demo.py

This commit is contained in:
imClumsyPanda 2023-04-14 01:06:13 +08:00
parent 5f70ce191c
commit 7b3e782023
2 changed files with 22 additions and 6 deletions

12
requirements.txt Normal file
View File

@ -0,0 +1,12 @@
langchain>=0.0.124
transformers==4.27.1
unstructured[local-inference]
layoutparser[layoutmodels,tesseract]
nltk
sentence-transformers
beautifulsoup4
icetk
cpm_kernels
faiss-cpu
gradio>=3.25.0
detectron2@git+https://github.com/facebookresearch/detectron2.git@v0.6#egg=detectron2

View File

@ -59,6 +59,10 @@ def reinit_model(llm_model, embedding_model, llm_history_len, top_k):
top_k=top_k),
def get_vector_store(filepath):
local_doc_qa.init_knowledge_vector_store("content/"+filepath)
model_status = gr.State()
history = gr.State([])
vs_path = gr.State()
@ -141,12 +145,12 @@ with gr.Blocks(css="""
file.upload(upload_file,
inputs=file,
outputs=selectFile)
# load_button.click(local_doc_qa.init_knowledge_vector_store,
# show_progress=True,
# api_name="init_knowledge_vector_store",
# inputs=selectFile,
# outputs=vs_path
# ).then(
load_button.click(get_vector_store,
show_progress=True,
api_name="init_knowledge_vector_store",
inputs=selectFile,
outputs=vs_path
)#.then(
# get_file_status,
# chatbot,
# chatbot,