com3dian commited on
Commit
77bbf66
·
verified ·
1 Parent(s): 6f670c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -36
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
- with open('slides_text.pkl', 'rb') as file:
79
- summ_text = pickle.load(file)
80
 
81
- # Function to render HTML content
82
- def render_html(text):
83
- return f"<div>{text}</div>"
84
-
85
- # Initialize session state for page index
86
- if 'page_index' not in st.session_state:
87
- st.session_state.page_index = 0
88
-
89
- # Function to handle page turn
90
- def turn_page(direction):
91
- if direction == "next" and st.session_state.page_index < len(text_list) - 1:
92
- st.session_state.page_index += 1
93
- elif direction == "prev" and st.session_state.page_index > 0:
94
- st.session_state.page_index -= 1
95
-
96
- # Display page turner controls
97
- col1, col2, col3 = st.columns([1, 2, 1])
98
- with col1:
99
- st.button("Previous", on_click=turn_page, args=("prev",))
100
- with col3:
101
- st.button("Next", on_click=turn_page, args=("next",))
102
- with col2:
103
- st.write(f"Page {st.session_state.page_index + 1} of {len(text_list)}")
104
-
105
- # Display editable text box
106
- text = st.text_area("Edit Text", summ_text[st.session_state.page_index], height=200)
107
-
108
- # Display HTML box
109
- st.markdown(render_html(text), unsafe_allow_html=True)
110
-
111
- # Update list with edited text
112
- text_list[st.session_state.page_index] = text
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