Created
July 28, 2023 16:51
-
-
Save JoelBender/8e79a06f15d93bd9915f1309dddc7913 to your computer and use it in GitHub Desktop.
Streamlit relative import
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 | |
import os | |
import os.path | |
import streamlit as st | |
from streamlit.logger import get_logger | |
# humph | |
# utils_path = os.path.realpath(os.path.pardir) | |
# if utils_path not in sys.path: | |
# sys.path.insert(1, os.path.realpath(os.path.pardir)) | |
from ..utils import load_graph | |
LOGGER = get_logger(__name__) | |
def run(): | |
LOGGER.debug("run") | |
st.set_page_config( | |
page_title="Info", | |
) | |
st.write("# Graph Information") | |
graph = load_graph() | |
st.write(graph) | |
if __name__ == "__main__": | |
run() |
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 | |
import streamlit as st | |
from streamlit.logger import get_logger | |
from utils import load_graph | |
LOGGER = get_logger(__name__) | |
def run(): | |
LOGGER.debug("run") | |
st.set_page_config( | |
page_title="Snork", | |
page_icon="👋", | |
) | |
st.write("# Welcome to Snork! 👋") | |
graph = load_graph() | |
st.write(graph) | |
if __name__ == "__main__": | |
run() |
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 | |
import streamlit as st | |
from streamlit.logger import get_logger | |
LOGGER = get_logger(__name__) | |
@st.cache_resource | |
def load_graph(): | |
LOGGER.debug("load_graph") | |
return "just a thing" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment