Guru-25 commited on
Commit
a65b65e
·
1 Parent(s): 625431b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -1
app.py CHANGED
@@ -2,7 +2,30 @@ import streamlit as st
2
  from utils import *
3
  import constants
4
 
5
- st.set_page_config(initial_sidebar_state="collapsed")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  hide_streamlit_style = """
7
  <style>
8
  #MainMenu {visibility: hidden;}
@@ -11,6 +34,7 @@ hide_streamlit_style = """
11
  </style>
12
  """
13
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
 
14
 
15
  if 'HuggingFace_API_Key' not in st.session_state:
16
  st.session_state['HuggingFace_API_Key'] ='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'
 
2
  from utils import *
3
  import constants
4
 
5
+ import base64
6
+
7
+ def get_base64(bin_file):
8
+ with open(bin_file, 'rb') as f:
9
+ data = f.read()
10
+ return base64.b64encode(data).decode()
11
+
12
+ def set_background(png_file):
13
+ bin_str = get_base64(png_file)
14
+ page_bg_img = '''
15
+ <style>
16
+ .stApp {
17
+ background-image: url("data:img.jpg;base64,%s");
18
+ background-size: cover;
19
+ }
20
+ </style>
21
+ ''' % bin_str
22
+ st.markdown(page_bg_img, unsafe_allow_html=True)
23
+
24
+ st.set_page_config(
25
+ page_title="TCE Chat Bot",
26
+ initial_sidebar_state="collapsed"
27
+ )
28
+
29
  hide_streamlit_style = """
30
  <style>
31
  #MainMenu {visibility: hidden;}
 
34
  </style>
35
  """
36
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
37
+ set_background('./15683.jpg')
38
 
39
  if 'HuggingFace_API_Key' not in st.session_state:
40
  st.session_state['HuggingFace_API_Key'] ='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'