Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
|
|
|
| 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(
|
| 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 |
|