update cli_demo.py
This commit is contained in:
parent
5f70ce191c
commit
7b3e782023
|
|
@ -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
|
||||||
16
webui.py
16
webui.py
|
|
@ -59,6 +59,10 @@ def reinit_model(llm_model, embedding_model, llm_history_len, top_k):
|
||||||
top_k=top_k),
|
top_k=top_k),
|
||||||
|
|
||||||
|
|
||||||
|
def get_vector_store(filepath):
|
||||||
|
local_doc_qa.init_knowledge_vector_store("content/"+filepath)
|
||||||
|
|
||||||
|
|
||||||
model_status = gr.State()
|
model_status = gr.State()
|
||||||
history = gr.State([])
|
history = gr.State([])
|
||||||
vs_path = gr.State()
|
vs_path = gr.State()
|
||||||
|
|
@ -141,12 +145,12 @@ with gr.Blocks(css="""
|
||||||
file.upload(upload_file,
|
file.upload(upload_file,
|
||||||
inputs=file,
|
inputs=file,
|
||||||
outputs=selectFile)
|
outputs=selectFile)
|
||||||
# load_button.click(local_doc_qa.init_knowledge_vector_store,
|
load_button.click(get_vector_store,
|
||||||
# show_progress=True,
|
show_progress=True,
|
||||||
# api_name="init_knowledge_vector_store",
|
api_name="init_knowledge_vector_store",
|
||||||
# inputs=selectFile,
|
inputs=selectFile,
|
||||||
# outputs=vs_path
|
outputs=vs_path
|
||||||
# ).then(
|
)#.then(
|
||||||
# get_file_status,
|
# get_file_status,
|
||||||
# chatbot,
|
# chatbot,
|
||||||
# chatbot,
|
# chatbot,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue