CB commited on
Commit
7fbf102
·
verified ·
1 Parent(s): b52722e

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +4 -8
streamlit_app.py CHANGED
@@ -164,18 +164,14 @@ if st.session_state["url"]:
164
  if st.session_state["videos"]:
165
 
166
  try:
167
- st.sidebar.video(
168
- st.session_state["videos"],
169
- loop = st.session_state.get("loop_video", False)
170
- )
171
  except Exception as e:
172
  st.write("Couldn't show video")
173
 
174
  with st.sidebar.expander("Options", expanded=False):
175
- #Loop button
176
- loop_button = st.button("Toggle Loop", key="loop_button")
177
- if loop_button:
178
- st.session_state["loop_video"] = not st.session_state.get("loop_video", False)
179
 
180
  #Clear button
181
  st.button("Clear Video 🔥", on_click=_remove_all_videos, type="secondary", help="Clear all downloaded videos", use_container_width=True,)
 
164
  if st.session_state["videos"]:
165
 
166
  try:
167
+ st.sidebar.video(st.session_state["videos"], loop=st.session_state.get("loop_video", False))
 
 
 
168
  except Exception as e:
169
  st.write("Couldn't show video")
170
 
171
  with st.sidebar.expander("Options", expanded=False):
172
+ #Loop checkbox
173
+ loop_checkbox = st.checkbox("Enable Loop", value=st.session_state.get("loop_video", True), key="loop_checkbox")
174
+ st.session_state["loop_video"] = loop_checkbox # Update session state based on checkbox
 
175
 
176
  #Clear button
177
  st.button("Clear Video 🔥", on_click=_remove_all_videos, type="secondary", help="Clear all downloaded videos", use_container_width=True,)