Spaces:
Sleeping
Sleeping
Create app.py
Browse files12345678910111213141516171819202122232425262728293031323334353637import streamlit as stimport importlib.utilimport sysimport os
# Define the options in the dropdown menuapp_options = { "Create CSVs": "create", "Merge CSVs": "merge", "Upload Datasets": "upload", "Create Chatbot": "chatbot"}
# Sidebar dropdown for selecting the applicationselected_app = st.sidebar.selectbox("Select Application", list(app_options.keys()))
# Clear session state when switching appsif 'last_selected_app' in st.session_state: if st.session_state.last_selected_app != selected_app: st.session_state.clear()
st.session_state.last_selected_app = selected_app
# Function to load and run the selected applicationdef load_app(app_path): module_name = os.path.splitext(os.path.basename(app_path))[0]
if module_name in sys.modules: del sys.modules[module_name]
spec = importlib.util.spec_from_file_location(module_name, app_path) module = importlib.util.module_from_spec(spec) sys.modules[module_name] = module spec.loader.exec_module(module)
# Load and run the selected applicationload_app(app_options[selected_app])app.pyAdded+37