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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -25
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
- # 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}")
 
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}")