Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,8 +48,6 @@ if uploaded_file is not None:
|
|
| 48 |
|
| 49 |
# read paper content
|
| 50 |
essay = monkeyReader.readEssay(saved_file_path)
|
| 51 |
-
for key, values in essay.items():
|
| 52 |
-
st.write(f"{key}: {', '.join(values)}")
|
| 53 |
|
| 54 |
# with st.status("Understanding paper..."):
|
| 55 |
|
|
@@ -75,41 +73,41 @@ if uploaded_file is not None:
|
|
| 75 |
# st.write(summ)
|
| 76 |
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
|
| 114 |
|
| 115 |
|
|
|
|
| 48 |
|
| 49 |
# read paper content
|
| 50 |
essay = monkeyReader.readEssay(saved_file_path)
|
|
|
|
|
|
|
| 51 |
|
| 52 |
# with st.status("Understanding paper..."):
|
| 53 |
|
|
|
|
| 73 |
# st.write(summ)
|
| 74 |
|
| 75 |
|
| 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 |
+
return f"<div>{text}</div>"
|
| 82 |
+
|
| 83 |
+
# Initialize session state for page index
|
| 84 |
+
if 'page_index' not in st.session_state:
|
| 85 |
+
st.session_state.page_index = 0
|
| 86 |
+
|
| 87 |
+
# Function to handle page turn
|
| 88 |
+
def turn_page(direction):
|
| 89 |
+
if direction == "next" and st.session_state.page_index < len(text_list) - 1:
|
| 90 |
+
st.session_state.page_index += 1
|
| 91 |
+
elif direction == "prev" and st.session_state.page_index > 0:
|
| 92 |
+
st.session_state.page_index -= 1
|
| 93 |
+
|
| 94 |
+
# Display page turner controls
|
| 95 |
+
col1, col2, col3 = st.columns([1, 2, 1])
|
| 96 |
+
with col1:
|
| 97 |
+
st.button("Previous", on_click=turn_page, args=("prev",))
|
| 98 |
+
with col3:
|
| 99 |
+
st.button("Next", on_click=turn_page, args=("next",))
|
| 100 |
+
with col2:
|
| 101 |
+
st.write(f"Page {st.session_state.page_index + 1} of {len(text_list)}")
|
| 102 |
+
|
| 103 |
+
# Display editable text box
|
| 104 |
+
text = st.text_area("Edit Text", summ_text[st.session_state.page_index], height=200)
|
| 105 |
+
|
| 106 |
+
# Display HTML box
|
| 107 |
+
st.markdown(render_html(text), unsafe_allow_html=True)
|
| 108 |
+
|
| 109 |
+
# Update list with edited text
|
| 110 |
+
text_list[st.session_state.page_index] = text
|
| 111 |
|
| 112 |
|
| 113 |
|