import streamlit as st import base64 import os def _logo_b64(size: int) -> str: logo_path = os.path.join(os.path.dirname(__file__), "..", "logo.png") logo_path = os.path.normpath(logo_path) if not os.path.exists(logo_path): return "" with open(logo_path, "rb") as f: data = base64.b64encode(f.read()).decode() return f'' def _logo_img_tag(size: int) -> str: tag = _logo_b64(size) return tag if tag else _logo_svg_fallback(size) def _logo_svg_fallback(size: int) -> str: grad_id = "swirl1" if size > 40 else "s1" grad_id2 = "swirl2" if size > 40 else "s2" return f""" """ # Pre-compute at import time LOGO_SVG = _logo_img_tag(56) LOGO_SVG_SMALL = _logo_img_tag(36) def apply_theme(): st.sidebar.markdown( f'
' f'{LOGO_SVG_SMALL}' f'
Discovery Lens
' f'
Discovery data is everywhere. Insight isn\'t.
' f'
', unsafe_allow_html=True, ) st.markdown(""" """, unsafe_allow_html=True)