"""Functions for the layout of the Streamlit app, including the sidebar.""" import json import os from typing import Literal import streamlit as st from src import hf_utils from src.config_parameters import params def get_aoi_id_from_selector_preview(all_aois, name_id_preview): for aoi_id, aoi in all_aois.items(): if aoi["name_id_preview"] == name_id_preview: return aoi_id # Check if app is deployed def is_app_on_streamlit(): """Check whether the app is on streamlit or runs locally.""" return "HOSTNAME" in os.environ and os.environ["HOSTNAME"] == "streamlit" # General layout def toggle_menu_button(): """If app is on streamlit, hide menu button.""" if is_app_on_streamlit(): st.markdown( """ """, unsafe_allow_html=True, ) # Home page def set_home_page_style(): """Set style home page.""" st.markdown( """ """ % params["docs_fontsize"], unsafe_allow_html=True, ) # Documentation page def set_doc_page_style(): """Set style documentation page.""" st.markdown( """ """ % params["docs_fontsize"], unsafe_allow_html=True, ) # Tool page def set_tool_page_style(): """Set style tool page.""" st.markdown( """ """ % ( params["expander_header_fontsize"], params["widget_header_fontsize"], params["widget_header_fontsize"], params["widget_header_fontsize"], params["button_text_fontsize"], params["button_text_fontweight"], params["button_background_color"], ), unsafe_allow_html=True, ) # Sidebar def add_about(): """ Add about and contacts to sidebar. Inputs: None Returns: None """ # About textbox st.sidebar.markdown("## About") st.sidebar.markdown( f"""
Todo: general about stuff
Github Repo
%s