Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -303,34 +303,24 @@ APA Citations:
|
|
| 303 |
else:
|
| 304 |
st.success("β
No major overlaps found.")
|
| 305 |
|
| 306 |
-
# πΉ Follow-up Interaction (Always Visible)
|
| 307 |
st.subheader("π¬ Ask a Follow-Up")
|
|
|
|
|
|
|
|
|
|
| 308 |
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
# Handle Submit Button
|
| 316 |
-
if st.button("π Submit Follow-Up") and st.session_state["follow_input"]:
|
| 317 |
-
if st.session_state["last_report"]:
|
| 318 |
-
try:
|
| 319 |
-
follow_prompt = [
|
| 320 |
-
{"role": "system", "content": "You are a helpful academic assistant."},
|
| 321 |
-
{"role": "user", "content": st.session_state["last_report"]},
|
| 322 |
-
{"role": "user", "content": st.session_state["follow_input"]}
|
| 323 |
-
]
|
| 324 |
-
follow_output = ""
|
| 325 |
-
follow_box = st.empty()
|
| 326 |
-
for chunk in call_llm(follow_prompt):
|
| 327 |
-
follow_output += chunk
|
| 328 |
-
follow_box.markdown(follow_output, unsafe_allow_html=True)
|
| 329 |
-
except Exception as e:
|
| 330 |
-
st.error(f"β Follow-up failed: {e}")
|
| 331 |
-
else:
|
| 332 |
-
st.warning("β οΈ Please generate a report first.")
|
| 333 |
-
|
| 334 |
|
| 335 |
except Exception as e:
|
| 336 |
st.error(f"β Error occurred: {e}")
|
|
|
|
| 303 |
else:
|
| 304 |
st.success("β
No major overlaps found.")
|
| 305 |
|
|
|
|
| 306 |
st.subheader("π¬ Ask a Follow-Up")
|
| 307 |
+
follow_input = st.text_input("Ask a question about the report:")
|
| 308 |
+
if st.button("π Submit Follow-Up") and follow_input:
|
| 309 |
+
st.session_state.followup_question = follow_input
|
| 310 |
|
| 311 |
+
if st.session_state.followup_question and st.session_state.last_report:
|
| 312 |
+
follow_prompt = [
|
| 313 |
+
{"role": "system", "content": "You are a helpful academic assistant."},
|
| 314 |
+
{"role": "user", "content": st.session_state.last_report},
|
| 315 |
+
{"role": "user", "content": st.session_state.followup_question}
|
| 316 |
+
]
|
| 317 |
+
follow_output = ""
|
| 318 |
+
follow_box = st.empty()
|
| 319 |
+
for chunk in call_llm(follow_prompt):
|
| 320 |
+
follow_output += chunk
|
| 321 |
+
follow_box.markdown(follow_output, unsafe_allow_html=True)
|
| 322 |
|
| 323 |
+
st.session_state.followup_question = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
|
| 325 |
except Exception as e:
|
| 326 |
st.error(f"β Error occurred: {e}")
|