MadhuV28 commited on
Commit
effa5a6
·
1 Parent(s): 9c71c4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -10
app.py CHANGED
@@ -1,4 +1,27 @@
1
  import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  add_selectbox = st.sidebar.selectbox(
4
  "How would you like to be contacted?",
@@ -9,13 +32,4 @@ with st.sidebar:
9
  add_radio = st.radio(
10
  "What day are you available",
11
  ("Monday", "Tuesday","Wednesday","Thursday", "Friday","Saturday","Sunday")
12
- page_bg_img = '''
13
- <style>
14
- body {
15
- background-image: url("https://images.unsplash.com/photo-1542281286-9e0a16bb7366");
16
- background-size: cover;
17
- }
18
- </style>
19
- '''
20
-
21
- st.markdown(page_bg_img, unsafe_allow_html=True)
 
1
  import streamlit as st
2
+ import base64
3
+ import streamlit as st
4
+
5
+
6
+ def get_base64(bin_file):
7
+ with open(bin_file, 'rb') as f:
8
+ data = f.read()
9
+ return base64.b64encode(data).decode()
10
+
11
+
12
+ def set_background(png_file):
13
+ bin_str = get_base64(png_file)
14
+ page_bg_img = '''
15
+ <style>
16
+ body {
17
+ background-image: url("data:image/png;base64,%s");
18
+ background-size: cover;
19
+ }
20
+ </style>
21
+ ''' % bin_str
22
+ st.markdown(page_bg_img, unsafe_allow_html=True)
23
+
24
+ set_background('./images/background.png')
25
 
26
  add_selectbox = st.sidebar.selectbox(
27
  "How would you like to be contacted?",
 
32
  add_radio = st.radio(
33
  "What day are you available",
34
  ("Monday", "Tuesday","Wednesday","Thursday", "Friday","Saturday","Sunday")
35
+