jokify-app / app.py
suneeln-duke's picture
Updated Logos
70651c8
import streamlit as st
from pages.pred_page import *
from pages.guess_page import *
import base64
from streamlit_option_menu import option_menu
def get_base64(bin_file):
with open(bin_file, 'rb') as f:
data = f.read()
return base64.b64encode(data).decode()
def set_background(png_file):
bin_str = get_base64(png_file)
page_bg_img = '''
<style>
.stApp {
background-image: url("data:image/jpg;base64,%s");
background-size: cover;
}
</style>
''' % bin_str
st.markdown(page_bg_img, unsafe_allow_html=True)
if __name__ == '__main__':
st.set_page_config( page_title="Home", layout="wide", initial_sidebar_state="collapsed", page_icon = "🏟️")
page_tab = option_menu(None, ["Predict", "Take A Guess"],
icons=['tags','question-circle'],
menu_icon="cast", default_index=0, orientation="horizontal")
if page_tab == "Predict":
set_background("images/stand-up-comedy.jpg")
pred_page_config()
elif page_tab == "Take A Guess":
set_background("images/dropout.jpg")
guess_page_config()