Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -85,11 +85,6 @@ def main():
|
|
85 |
st.markdown("<h1 style='font-size:24px;'>ChatBot by Muhammad Huzaifa</h1>", unsafe_allow_html=True)
|
86 |
api_key = st.secrets["inference_api_key"]
|
87 |
|
88 |
-
user_question = st.text_input("Ask a question from the Docs")
|
89 |
-
|
90 |
-
if user_question:
|
91 |
-
user_input(user_question, api_key)
|
92 |
-
|
93 |
with st.sidebar:
|
94 |
st.title("Menu:")
|
95 |
pdf_docs = st.file_uploader("Upload your PDF Files and Click on the Submit & Process Button", accept_multiple_files=True)
|
@@ -99,6 +94,16 @@ def main():
|
|
99 |
text_chunks = get_text_chunks(raw_text)
|
100 |
get_vector_store(text_chunks, api_key)
|
101 |
st.success("Done")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
if __name__ == "__main__":
|
104 |
main()
|
|
|
85 |
st.markdown("<h1 style='font-size:24px;'>ChatBot by Muhammad Huzaifa</h1>", unsafe_allow_html=True)
|
86 |
api_key = st.secrets["inference_api_key"]
|
87 |
|
|
|
|
|
|
|
|
|
|
|
88 |
with st.sidebar:
|
89 |
st.title("Menu:")
|
90 |
pdf_docs = st.file_uploader("Upload your PDF Files and Click on the Submit & Process Button", accept_multiple_files=True)
|
|
|
94 |
text_chunks = get_text_chunks(raw_text)
|
95 |
get_vector_store(text_chunks, api_key)
|
96 |
st.success("Done")
|
97 |
+
|
98 |
+
# Check if any document is uploaded
|
99 |
+
if pdf_docs:
|
100 |
+
user_question = st.text_input("Ask a question from the Docs")
|
101 |
+
|
102 |
+
if user_question:
|
103 |
+
user_input(user_question, api_key)
|
104 |
+
else:
|
105 |
+
st.write("Please upload a document first to ask questions.")
|
106 |
+
|
107 |
|
108 |
if __name__ == "__main__":
|
109 |
main()
|