import streamlit as st import base64 @st.cache_data def get_base64_of_bin_file(png_file): with open(png_file, "rb") as f: data = f.read() return base64.b64encode(data).decode() def build_markup_for_logo( png_file, background_position="50% 10%", margin_top="10%", image_width="60%", image_height="", ): binary_string = get_base64_of_bin_file(png_file) return """ """ % ( binary_string, background_position, margin_top, image_width, image_height, ) def add_logo(png_file): logo_markup = build_markup_for_logo(png_file) st.markdown( logo_markup, unsafe_allow_html=True, )