com3dian commited on
Commit
6b99783
·
verified ·
1 Parent(s): b17cdba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -77,13 +77,15 @@ with open('slides_text.pkl', 'rb') as file:
77
  summ_text = pickle.load(file)
78
 
79
  # Function to render HTML content
80
- def render_html(text):
81
- # Split text by periods
82
- sentences = text.split('.')
83
- # Create HTML list items
84
- list_items = "".join([f"<li>{sentence.strip()}.</li>" for sentence in sentences if sentence.strip()])
85
- # Wrap list items in an unordered list
86
- return f"<ul>{list_items}</ul>"
 
 
87
 
88
  # Initialize session state for page index and text
89
  if 'page_index' not in st.session_state:
@@ -93,7 +95,7 @@ if 'current_text' not in st.session_state:
93
  st.session_state.current_text = summ_text[st.session_state.page_index]
94
 
95
  if 'summ_text' not in st.session_state:
96
- st.session_state.summ_text = summ_text
97
 
98
  # Function to handle page turn
99
  def turn_page(direction):
@@ -136,6 +138,6 @@ with col3:
136
  )
137
 
138
  # Display HTML box
139
- st.markdown(render_html(st.session_state.current_text), unsafe_allow_html=True)
140
 
141
 
 
77
  summ_text = pickle.load(file)
78
 
79
  # Function to render HTML content
80
+ def format(text_list):
81
+ format_list = []
82
+ for text in text_list:
83
+ # Split text by periods
84
+ sentences = text.split('.')
85
+ # Create HTML list items
86
+ list_items = "".join(["- {sentence.strip()}" for sentence in sentences if sentence.strip()])
87
+ format_list.append(list_items)
88
+ return format_list
89
 
90
  # Initialize session state for page index and text
91
  if 'page_index' not in st.session_state:
 
95
  st.session_state.current_text = summ_text[st.session_state.page_index]
96
 
97
  if 'summ_text' not in st.session_state:
98
+ st.session_state.summ_text = format(summ_text)
99
 
100
  # Function to handle page turn
101
  def turn_page(direction):
 
138
  )
139
 
140
  # Display HTML box
141
+ st.markdown(st.session_state.current_text)
142
 
143