Spaces:
Build error
Build error
Download test.py from Proton-Datalabs-dev/Smart-Tasker: direct link, hf CLI and curl.
- Browser
- Download file 935 Bytes
-
https://huggingface.co/spaces/Proton-Datalabs-dev/Smart-Tasker/resolve/main/test.py
- Command line
-
hf download hf://spaces/Proton-Datalabs-dev/Smart-Tasker/test.py
-
curl -L -o test.py https://huggingface.co/spaces/Proton-Datalabs-dev/Smart-Tasker/resolve/main/test.py
935 Bytes
| import streamlit as st | |
| # Initialize session state to track the active tab | |
| if 'active_tab' not in st.session_state: | |
| st.session_state.active_tab = 0 # Set default tab (0 for first tab) | |
| # Create tabs using st.radio or st.selectbox | |
| tab_options = ['Tab 1', 'Tab 2', 'Tab 3'] | |
| selected_tab = st.radio('Select a tab', tab_options, index=st.session_state.active_tab) | |
| # Some condition to trigger the tab change (for example, based on user input or action) | |
| def some_condition(): | |
| # Define your condition, for example, a button press or other condition | |
| return st.button('Switch to Tab 2') | |
| # Conditionally switch tabs based on a condition | |
| if some_condition(): | |
| st.session_state.active_tab = 1 # Switch to Tab 2 (index 1) | |
| # Render content based on the selected tab | |
| if selected_tab == 'Tab 1': | |
| st.write("You are on Tab 1") | |
| elif selected_tab == 'Tab 2': | |
| st.write("You are on Tab 2") | |
| else: | |
| st.write("You are on Tab 3") | |