From c81fe36d71c464dd9772404beffe00e239bc784a Mon Sep 17 00:00:00 2001 From: cardosofede Date: Mon, 24 Jul 2023 17:20:55 +0200 Subject: [PATCH] (feat) add function to initialize pages --- utils/st_utils.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 utils/st_utils.py diff --git a/utils/st_utils.py b/utils/st_utils.py new file mode 100644 index 0000000..51800d1 --- /dev/null +++ b/utils/st_utils.py @@ -0,0 +1,20 @@ +import os.path +from pathlib import Path +import inspect + +import streamlit as st + + +def initialize_st_page(title: str, icon: str, layout="wide"): + st.set_page_config( + page_title=title, + page_icon=icon, + layout=layout, + ) + st.title(f"{icon} {title}") + caller_frame = inspect.currentframe().f_back + + current_directory = Path(os.path.dirname(inspect.getframeinfo(caller_frame).filename)) + readme_path = current_directory / "README.md" + with st.expander("About This Page"): + st.write(readme_path.read_text())