import streamlit as st import time # Predefined list of URLs URL_LIST = ['https://eversense.forbesmarshall.com/dashboard/c4fd54f0-c1db-11ef-85d0-039aa56777b8?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/3e2088d0-305f-11ee-a0f4-61e9161020b8?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/28363120-2793-11ee-b1bd-d337304025bb?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/7a6d5b10-0378-11ee-82c9-cf44d27abef7?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/5bbfcf20-7ca1-11ee-8ff0-1ff70966bd0b?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/fce0ba90-a0d1-11ef-bb0b-1fc19820fcd6?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/c62a1620-c1d0-11ef-8fbe-512a6c27d06a?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/3dea3f20-5786-11ee-b3f1-c132cb361d73?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/a03dbd20-b2ff-11ef-946d-9f2f4424b7fb?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/77c97b40-2174-11ee-8c9f-7bdade8f0907?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/d1fea240-c1b2-11ef-85d0-039aa56777b8?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/46c34860-c1d6-11ef-85d0-039aa56777b8?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/70f29e80-b2e8-11ef-946d-9f2f4424b7fb?state=W3sicGFyYW1zIjp7fX1d', 'https://eversense.forbesmarshall.com/dashboard/6ab1c430-b15b-11ef-a0e7-1fc19820fcd6?state=W3sicGFyYW1zIjp7fX1d' ]; # Initialize session state if 'running' not in st.session_state: st.session_state.running = False if 'current_index' not in st.session_state: st.session_state.current_index = 0 if 'interval' not in st.session_state: st.session_state.interval = 5 # Default interval in seconds def toggle_running(): st.session_state.running = not st.session_state.running def next_url(): st.session_state.current_index = (st.session_state.current_index + 1) % len(URL_LIST) # UI Components st.title("Rotating Website Viewer") st.write("Cycles through predefined URLs at a set interval.") # Interval selection st.session_state.interval = st.slider("Select interval (seconds)", 10, 6000, st.session_state.interval) # Start/Stop button if st.button("Start" if not st.session_state.running else "Stop", on_click=toggle_running): pass # Display website in an iframe current_url = URL_LIST[st.session_state.current_index] st.markdown(f'', unsafe_allow_html=True) # Rotation logic if st.session_state.running: time.sleep(st.session_state.interval) next_url() st.rerun()