Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -76,10 +76,8 @@ if 'variable_name' not in locals():
|
|
76 |
with open('slides_text.pkl', 'rb') as file:
|
77 |
summ_text = pickle.load(file)
|
78 |
|
79 |
-
|
80 |
# Function to render HTML content
|
81 |
def render_html(text):
|
82 |
-
summ_text[st.session_state.page_index] = text
|
83 |
# Split text by periods
|
84 |
sentences = text.split('.')
|
85 |
# Create HTML list items
|
@@ -102,8 +100,10 @@ def turn_page(direction):
|
|
102 |
st.session_state.page_index -= 1
|
103 |
st.session_state.current_text = summ_text[st.session_state.page_index]
|
104 |
|
105 |
-
|
106 |
-
|
|
|
|
|
107 |
|
108 |
# Display page turner controls
|
109 |
col1, col2, col3 = st.columns([1, 2, 1])
|
@@ -115,8 +115,9 @@ with col2:
|
|
115 |
st.write(f"Page {st.session_state.page_index + 1} of {len(summ_text)}")
|
116 |
|
117 |
# Display editable text box
|
118 |
-
text = st.text_area("Edit Text", st.session_state.current_text, height=200, key="text_area_value", on_change=
|
119 |
|
120 |
# Display HTML box
|
121 |
st.markdown(render_html(st.session_state.current_text), unsafe_allow_html=True)
|
122 |
|
|
|
|
76 |
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
|
|
|
100 |
st.session_state.page_index -= 1
|
101 |
st.session_state.current_text = summ_text[st.session_state.page_index]
|
102 |
|
103 |
+
# Function to update the current text based on text_area changes
|
104 |
+
def update_text():
|
105 |
+
summ_text[st.session_state.page_index] = st.session_state.text_area_value
|
106 |
+
st.session_state.current_text = st.session_state.text_area_value
|
107 |
|
108 |
# Display page turner controls
|
109 |
col1, col2, col3 = st.columns([1, 2, 1])
|
|
|
115 |
st.write(f"Page {st.session_state.page_index + 1} of {len(summ_text)}")
|
116 |
|
117 |
# Display editable text box
|
118 |
+
text = st.text_area("Edit Text", st.session_state.current_text, height=200, key="text_area_value", on_change=update_text)
|
119 |
|
120 |
# Display HTML box
|
121 |
st.markdown(render_html(st.session_state.current_text), unsafe_allow_html=True)
|
122 |
|
123 |
+
|