File size: 1,116 Bytes
51c3f70
 
 
7d4bdcd
 
51c3f70
 
 
7d4bdcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51c3f70
 
 
 
 
70651c8
 
51c3f70
 
70651c8
 
7d4bdcd
70651c8
7d4bdcd
70651c8
 
7d4bdcd
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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()