Ani14 commited on
Commit
181cf42
Β·
verified Β·
1 Parent(s): 1ef3c64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -20
app.py CHANGED
@@ -303,28 +303,34 @@ APA Citations:
303
  else:
304
  st.success("βœ… No major overlaps found.")
305
 
306
- # πŸ”Ή Follow-up Interaction
307
  st.subheader("πŸ’¬ Ask a Follow-Up")
308
- follow_input = st.text_input("Ask a question about the report:")
309
- if st.button("πŸ”„ Submit Follow-Up") and follow_input:
310
- st.session_state["follow_up"] = follow_input
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
 
312
- if st.session_state.get("follow_up") and st.session_state["last_report"]:
313
- try:
314
- follow_prompt = [
315
- {"role": "system", "content": "You are a helpful academic assistant."},
316
- {"role": "user", "content": st.session_state["last_report"]},
317
- {"role": "user", "content": st.session_state["follow_up"]}
318
- ]
319
- follow_output = ""
320
- follow_box = st.empty()
321
- for chunk in call_llm(follow_prompt):
322
- follow_output += chunk
323
- follow_box.markdown(follow_output, unsafe_allow_html=True)
324
- except Exception as e:
325
- st.error(f"Follow-up failed: {e}")
326
- finally:
327
- st.session_state["follow_up"] = ""
328
 
329
  except Exception as e:
330
  st.error(f"❌ Error occurred: {e}")
 
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
+ # Always-visible input box
310
+ if "follow_input" not in st.session_state:
311
+ st.session_state["follow_input"] = ""
312
+
313
+ st.session_state["follow_input"] = st.text_input("Ask a question about the report:", value=st.session_state["follow_input"])
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}")