Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -148,7 +148,7 @@ def main():
|
|
| 148 |
if st.button("Continue", type="primary") and user_api_key:
|
| 149 |
st.session_state["user_api_key"] = user_api_key
|
| 150 |
st.session_state["api_entered"] = True
|
| 151 |
-
st.
|
| 152 |
st.stop()
|
| 153 |
else:
|
| 154 |
st.session_state["user_api_key"] = api_key
|
|
@@ -173,7 +173,7 @@ def main():
|
|
| 173 |
get_vector_store(text_chunks, api_key)
|
| 174 |
st.session_state["pdf_processed"] = True
|
| 175 |
st.success("PDF processed successfully. You can now ask questions.")
|
| 176 |
-
st.
|
| 177 |
except FileNotFoundError as e:
|
| 178 |
st.error(str(e))
|
| 179 |
st.stop()
|
|
@@ -189,11 +189,11 @@ def main():
|
|
| 189 |
|
| 190 |
if st.button("Reprocess PDF"):
|
| 191 |
st.session_state["pdf_processed"] = False
|
| 192 |
-
st.
|
| 193 |
|
| 194 |
if st.button("Clear Chat History"):
|
| 195 |
st.session_state["messages"] = []
|
| 196 |
-
st.
|
| 197 |
|
| 198 |
st.markdown("---")
|
| 199 |
st.subheader("Quick Actions")
|
|
@@ -234,7 +234,7 @@ def main():
|
|
| 234 |
with st.spinner("Generating question..."):
|
| 235 |
response = get_response(quick_question, api_key, st.session_state["messages"])
|
| 236 |
st.session_state["messages"].append({"role": "assistant", "content": response})
|
| 237 |
-
st.
|
| 238 |
|
| 239 |
with col2:
|
| 240 |
if st.button("Summarize Topics", use_container_width=True):
|
|
@@ -243,7 +243,7 @@ def main():
|
|
| 243 |
with st.spinner("Analyzing..."):
|
| 244 |
response = get_response(quick_question, api_key, st.session_state["messages"])
|
| 245 |
st.session_state["messages"].append({"role": "assistant", "content": response})
|
| 246 |
-
st.
|
| 247 |
|
| 248 |
with col3:
|
| 249 |
if st.button("How can you help?", use_container_width=True):
|
|
@@ -252,7 +252,7 @@ def main():
|
|
| 252 |
with st.spinner("Processing..."):
|
| 253 |
response = get_response(quick_question, api_key, st.session_state["messages"])
|
| 254 |
st.session_state["messages"].append({"role": "assistant", "content": response})
|
| 255 |
-
st.
|
| 256 |
|
| 257 |
# Chat input
|
| 258 |
if user_question := st.chat_input("Ask a question or answer an MCQ..."):
|
|
|
|
| 148 |
if st.button("Continue", type="primary") and user_api_key:
|
| 149 |
st.session_state["user_api_key"] = user_api_key
|
| 150 |
st.session_state["api_entered"] = True
|
| 151 |
+
st.experimental_rerun()
|
| 152 |
st.stop()
|
| 153 |
else:
|
| 154 |
st.session_state["user_api_key"] = api_key
|
|
|
|
| 173 |
get_vector_store(text_chunks, api_key)
|
| 174 |
st.session_state["pdf_processed"] = True
|
| 175 |
st.success("PDF processed successfully. You can now ask questions.")
|
| 176 |
+
st.experimental_rerun()
|
| 177 |
except FileNotFoundError as e:
|
| 178 |
st.error(str(e))
|
| 179 |
st.stop()
|
|
|
|
| 189 |
|
| 190 |
if st.button("Reprocess PDF"):
|
| 191 |
st.session_state["pdf_processed"] = False
|
| 192 |
+
st.experimental_rerun()
|
| 193 |
|
| 194 |
if st.button("Clear Chat History"):
|
| 195 |
st.session_state["messages"] = []
|
| 196 |
+
st.experimental_rerun()
|
| 197 |
|
| 198 |
st.markdown("---")
|
| 199 |
st.subheader("Quick Actions")
|
|
|
|
| 234 |
with st.spinner("Generating question..."):
|
| 235 |
response = get_response(quick_question, api_key, st.session_state["messages"])
|
| 236 |
st.session_state["messages"].append({"role": "assistant", "content": response})
|
| 237 |
+
st.experimental_rerun()
|
| 238 |
|
| 239 |
with col2:
|
| 240 |
if st.button("Summarize Topics", use_container_width=True):
|
|
|
|
| 243 |
with st.spinner("Analyzing..."):
|
| 244 |
response = get_response(quick_question, api_key, st.session_state["messages"])
|
| 245 |
st.session_state["messages"].append({"role": "assistant", "content": response})
|
| 246 |
+
st.experimental_rerun()
|
| 247 |
|
| 248 |
with col3:
|
| 249 |
if st.button("How can you help?", use_container_width=True):
|
|
|
|
| 252 |
with st.spinner("Processing..."):
|
| 253 |
response = get_response(quick_question, api_key, st.session_state["messages"])
|
| 254 |
st.session_state["messages"].append({"role": "assistant", "content": response})
|
| 255 |
+
st.experimental_rerun()
|
| 256 |
|
| 257 |
# Chat input
|
| 258 |
if user_question := st.chat_input("Ask a question or answer an MCQ..."):
|