Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,12 +86,14 @@ def query_response(query, _retriever):
|
|
| 86 |
if "doc" not in st.session_state:
|
| 87 |
st.session_state.doc = ""
|
| 88 |
|
| 89 |
-
course_material = st.file_uploader("or Upload your own pdf", type="pdf")
|
| 90 |
|
| 91 |
if st.session_state != "":
|
| 92 |
try:
|
| 93 |
if st.button("load"):
|
| 94 |
-
|
|
|
|
|
|
|
| 95 |
st.success("File loading successful, vector db initialize")
|
| 96 |
except:
|
| 97 |
st.error("Upload your file")
|
|
@@ -114,7 +116,7 @@ if st.session_state != "":
|
|
| 114 |
st.markdown(message["content"])
|
| 115 |
|
| 116 |
# We take questions/instructions from the chat input to pass to the LLM
|
| 117 |
-
if user_prompt := st.chat_input("
|
| 118 |
# Add our input to the session state
|
| 119 |
st.session_state.messages.append({"role": "user", "content": user_prompt})
|
| 120 |
|
|
|
|
| 86 |
if "doc" not in st.session_state:
|
| 87 |
st.session_state.doc = ""
|
| 88 |
|
| 89 |
+
course_material = st.file_uploader("or Upload your own pdf", type="pdf", key='doc')
|
| 90 |
|
| 91 |
if st.session_state != "":
|
| 92 |
try:
|
| 93 |
if st.button("load"):
|
| 94 |
+
with st.soinner("loading document.."):
|
| 95 |
+
doc_retriever = get_retriever(course_material)
|
| 96 |
+
|
| 97 |
st.success("File loading successful, vector db initialize")
|
| 98 |
except:
|
| 99 |
st.error("Upload your file")
|
|
|
|
| 116 |
st.markdown(message["content"])
|
| 117 |
|
| 118 |
# We take questions/instructions from the chat input to pass to the LLM
|
| 119 |
+
if user_prompt := st.chat_input("Ask...", key="user_input"):
|
| 120 |
# Add our input to the session state
|
| 121 |
st.session_state.messages.append({"role": "user", "content": user_prompt})
|
| 122 |
|