Spaces:
Sleeping
Sleeping
import streamlit as st | |
import importlib.util | |
# Define the paths to the other apps | |
FIRST_APP_PATH = "app-memora.py" | |
SECOND_APP_PATH = "app-news-content.py" | |
def run_script(script_path): | |
""" | |
Dynamically load and execute a Python script's main() function. | |
""" | |
# Load the module from the script path | |
spec = importlib.util.spec_from_file_location("module.name", script_path) | |
module = importlib.util.module_from_spec(spec) | |
spec.loader.exec_module(module) | |
def main(): | |
st.sidebar.title("Navigation") | |
app_choice = st.sidebar.radio("Choose an App:", ["Memora", "Dynamic News Summarizer"]) | |
if app_choice == "Memora": | |
run_script(FIRST_APP_PATH) | |
elif app_choice == "Dynamic News Summarizer": | |
run_script(SECOND_APP_PATH) | |
if __name__ == "__main__": | |
main() | |