Joanna30 commited on
Commit
9a6f3ad
·
verified ·
1 Parent(s): fe6fd1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -31,18 +31,21 @@ if summarise_button:
31
  # Generate summary from conversation buffer
32
  summary = str(st.session_state['conversation'].memory.buffer)
33
 
34
- # Display summary in a formatted way like the conversation UI
35
- st.markdown("---") # Add a separator line
 
 
 
 
 
 
36
  st.markdown("<h3 style='text-align: center;'>Summary of Conversation</h3>", unsafe_allow_html=True)
37
 
38
- # Display the summary in the chat UI format
39
  summary_container = st.container()
40
  with summary_container:
41
- # Split the summary into individual lines or sentences
42
- summary_lines = summary.strip().split(". ")
43
- for i, line in enumerate(summary_lines):
44
- if line.strip(): # Avoid blank lines
45
- message(line.strip(), is_user=False, key=f"summary_{i}")
46
  else:
47
  st.sidebar.write("No conversation history to summarize.")
48
 
 
31
  # Generate summary from conversation buffer
32
  summary = str(st.session_state['conversation'].memory.buffer)
33
 
34
+ # Split summary into sentences
35
+ summary_sentences = summary.strip().split(". ")
36
+
37
+ # Exclude the first two sentences
38
+ filtered_summary = summary_sentences[2:]
39
+
40
+ # Display the remaining summary in chat-like format
41
+ st.markdown("---") # Separator line
42
  st.markdown("<h3 style='text-align: center;'>Summary of Conversation</h3>", unsafe_allow_html=True)
43
 
 
44
  summary_container = st.container()
45
  with summary_container:
46
+ for i, line in enumerate(filtered_summary):
47
+ if line: # Avoid blank lines
48
+ message(line, is_user=False, key=f"summary_{i}")
 
 
49
  else:
50
  st.sidebar.write("No conversation history to summarize.")
51