Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,8 +17,16 @@ from langchain_huggingface import ChatHuggingFace
|
|
17 |
from langchain_core.output_parsers import StrOutputParser
|
18 |
from langchain_huggingface import HuggingFaceEndpoint
|
19 |
from dotenv import load_dotenv
|
|
|
20 |
load_dotenv()
|
21 |
HF_token = os.environ["HF_TOKEN"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
######## Vector Store #######
|
23 |
# process all files and get the vectorstores collections
|
24 |
# vectorestore colection are stored on persistent storage so this needs to be run only once
|
@@ -93,7 +101,7 @@ async def chat(query,history,sources,reports,subtype,year):
|
|
93 |
|
94 |
##------------------------decide which collection to fetch------------------------------
|
95 |
if len(reports) == 0:
|
96 |
-
vectorstore = get_local_qdrant(
|
97 |
else:
|
98 |
vectorstore = get_local_qdrant("allreports")
|
99 |
|
@@ -317,6 +325,8 @@ with gr.Blocks(title="Audit Q&A", css= "style.css", theme=theme,elem_id = "main-
|
|
317 |
- By using this chatbot, you agree to these terms and acknowledge that you are solely responsible for any reliance on or actions taken based on its responses.
|
318 |
- **This is just a prototype and being tested and worked upon, so its not perfect and may sometimes give irrelevant answers**. If you are not satisfied with the answer, please ask a more specific question or report your feedback to help us improve the system.
|
319 |
""")
|
|
|
|
|
320 |
|
321 |
# using event listeners for 1. query box 2. click on example question
|
322 |
# https://www.gradio.app/docs/gradio/textbox#event-listeners-arguments
|
|
|
17 |
from langchain_core.output_parsers import StrOutputParser
|
18 |
from langchain_huggingface import HuggingFaceEndpoint
|
19 |
from dotenv import load_dotenv
|
20 |
+
import pkg_resources
|
21 |
load_dotenv()
|
22 |
HF_token = os.environ["HF_TOKEN"]
|
23 |
+
installed_packages = pkg_resources.working_set
|
24 |
+
package_list_ = ""
|
25 |
+
for package in installed_packages:
|
26 |
+
package_list_ = package_list_ + f"{package.key}=={package.version}\n"
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
######## Vector Store #######
|
31 |
# process all files and get the vectorstores collections
|
32 |
# vectorestore colection are stored on persistent storage so this needs to be run only once
|
|
|
101 |
|
102 |
##------------------------decide which collection to fetch------------------------------
|
103 |
if len(reports) == 0:
|
104 |
+
vectorstore = get_local_qdrant(sources)
|
105 |
else:
|
106 |
vectorstore = get_local_qdrant("allreports")
|
107 |
|
|
|
325 |
- By using this chatbot, you agree to these terms and acknowledge that you are solely responsible for any reliance on or actions taken based on its responses.
|
326 |
- **This is just a prototype and being tested and worked upon, so its not perfect and may sometimes give irrelevant answers**. If you are not satisfied with the answer, please ask a more specific question or report your feedback to help us improve the system.
|
327 |
""")
|
328 |
+
|
329 |
+
gr.DownloadButton("Download the file",value = "requirements.txt",inputs = package_list_, visible=True)
|
330 |
|
331 |
# using event listeners for 1. query box 2. click on example question
|
332 |
# https://www.gradio.app/docs/gradio/textbox#event-listeners-arguments
|