zmbfeng commited on
Commit
0196fd4
1 Parent(s): 365522e

stop button for auto scrolling done

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -40,16 +40,19 @@ if 'is_initialized' not in st.session_state:
40
  progress_percentage = (index) / (page_count - 1)
41
  read_pdf_progress_bar.progress(progress_percentage)
42
  st.session_state.img_index = 0
 
43
 
44
  #if 'img_index' not in st.session_state:
45
 
46
-
 
47
  st.write(str(st.session_state.img_index+1) +"/" + str(len(st.session_state.color_image_list)))
48
  st.image(st.session_state.gray_image_np_list[st.session_state.img_index], use_column_width=True)
49
- if st.session_state.img_index < len(st.session_state.color_image_list) - 1:
50
- st.session_state.img_index += 1
51
- time.sleep(3)
52
- st.rerun()
 
53
  # col1, col2 = st.columns(2)
54
  # with col1:
55
  # if st.button("Previous"):
 
40
  progress_percentage = (index) / (page_count - 1)
41
  read_pdf_progress_bar.progress(progress_percentage)
42
  st.session_state.img_index = 0
43
+ st.session_state.stop_button_clicked=False
44
 
45
  #if 'img_index' not in st.session_state:
46
 
47
+ if st.button("Stop"):
48
+ st.session_state.stop_button_clicked = True
49
  st.write(str(st.session_state.img_index+1) +"/" + str(len(st.session_state.color_image_list)))
50
  st.image(st.session_state.gray_image_np_list[st.session_state.img_index], use_column_width=True)
51
+ if not st.session_state.stop_button_clicked:
52
+ if st.session_state.img_index < len(st.session_state.color_image_list) - 1:
53
+ st.session_state.img_index += 1
54
+ time.sleep(3)
55
+ st.rerun()
56
  # col1, col2 = st.columns(2)
57
  # with col1:
58
  # if st.button("Previous"):