Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -10,10 +10,9 @@ import pandas as pd
|
|
10 |
import io
|
11 |
import time
|
12 |
|
13 |
-
from
|
14 |
from typing import List, Dict, Tuple
|
15 |
from langchain_openai import AzureChatOpenAI,AzureOpenAIEmbeddings
|
16 |
-
from langchain.vectorstores import FAISS
|
17 |
from langchain.text_splitter import CharacterTextSplitter
|
18 |
|
19 |
class PDFExtract:
|
@@ -261,11 +260,13 @@ if st.session_state.file_processed:
|
|
261 |
with st.spinner("Thinking..."):
|
262 |
response = chain.invoke({"input": question, 'lease_queries': lease_flow})
|
263 |
answer = response['answer']
|
|
|
264 |
|
265 |
# Add AI response to chat
|
266 |
st.session_state.messages.append({"role": "assistant", "content": answer})
|
267 |
with st.chat_message("assistant"):
|
268 |
-
st.write(
|
|
|
269 |
|
270 |
if "GASB" in answer:
|
271 |
st.info("Flow stopped due to GASB answer.")
|
@@ -292,11 +293,13 @@ if st.session_state.file_processed:
|
|
292 |
with st.spinner("Thinking..."):
|
293 |
response = chain.invoke({"input": question, 'lease_queries': lease_flow})
|
294 |
answer = response['answer']
|
|
|
295 |
|
296 |
# Add AI response to chat
|
297 |
st.session_state.messages.append({"role": "assistant", "content": answer})
|
298 |
with st.chat_message("assistant"):
|
299 |
-
st.write(
|
|
|
300 |
|
301 |
if "GASB" in answer:
|
302 |
st.info("Flow stopped due to GASB answer.")
|
|
|
10 |
import io
|
11 |
import time
|
12 |
|
13 |
+
from langchain_community.document_loaders import UnstructuredFileLoader
|
14 |
from typing import List, Dict, Tuple
|
15 |
from langchain_openai import AzureChatOpenAI,AzureOpenAIEmbeddings
|
|
|
16 |
from langchain.text_splitter import CharacterTextSplitter
|
17 |
|
18 |
class PDFExtract:
|
|
|
260 |
with st.spinner("Thinking..."):
|
261 |
response = chain.invoke({"input": question, 'lease_queries': lease_flow})
|
262 |
answer = response['answer']
|
263 |
+
source = response['context']
|
264 |
|
265 |
# Add AI response to chat
|
266 |
st.session_state.messages.append({"role": "assistant", "content": answer})
|
267 |
with st.chat_message("assistant"):
|
268 |
+
st.write(source)
|
269 |
+
st.success(answer)
|
270 |
|
271 |
if "GASB" in answer:
|
272 |
st.info("Flow stopped due to GASB answer.")
|
|
|
293 |
with st.spinner("Thinking..."):
|
294 |
response = chain.invoke({"input": question, 'lease_queries': lease_flow})
|
295 |
answer = response['answer']
|
296 |
+
source = response['context']
|
297 |
|
298 |
# Add AI response to chat
|
299 |
st.session_state.messages.append({"role": "assistant", "content": answer})
|
300 |
with st.chat_message("assistant"):
|
301 |
+
st.write(source)
|
302 |
+
st.success(answer)
|
303 |
|
304 |
if "GASB" in answer:
|
305 |
st.info("Flow stopped due to GASB answer.")
|