Created
November 7, 2020 21:34
-
-
Save urigoren/fa84538c80cf693ef79c2c880885bc3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os | |
import streamlit as st | |
def file2page_name(fname): | |
return fname.replace('.py', '').split("_", 1)[1].title() | |
sys.path.append("..") | |
page_files = dict() | |
for fname in os.listdir('.'): | |
if fname.startswith("page_") and fname.endswith(".py"): | |
page_files[file2page_name(fname)] = fname | |
page = st.sidebar.radio("Pages ", list(page_files.keys()), 0) | |
st.write("# " + page) | |
with open(page_files[page], 'r') as f: | |
exec(f.read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment