danupurnomo commited on
Commit
2e4d594
·
1 Parent(s): 5fe00f3

Set the background

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -56,15 +56,37 @@ def convert_img_to_base64(img_path):
56
  encoded_string = base64.b64encode(image_file.read())
57
  return encoded_string
58
 
59
- # # img_background_path = os.path.join(img_path, '01 - background.jpg')
60
  # img_background_path = os.path.join(img_path, 'test-02.jpg')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  # encoded_string = convert_img_to_base64(img_background_path)
62
  # st.markdown(
63
  # f"""
64
  # <style>
65
  # .stApp {{
66
  # background-image: url(data:image/{"jpg"};base64,{encoded_string.decode()});
67
- # background-size: cover;
 
 
 
 
68
  # }}
69
 
70
  # </style>
 
56
  encoded_string = base64.b64encode(image_file.read())
57
  return encoded_string
58
 
59
+ img_background_path = os.path.join(img_path, '01 - background.jpg')
60
  # img_background_path = os.path.join(img_path, 'test-02.jpg')
61
+ encoded_string = convert_img_to_base64(img_background_path)
62
+ st.markdown(
63
+ f"""
64
+ <style>
65
+ .stApp {{
66
+ background-image: url(data:image/{"jpg"};base64,{encoded_string.decode()});
67
+ background-size: 100%;
68
+ background-repeat: no-repeat;
69
+ background-attachment: local;
70
+ }}
71
+
72
+ </style>
73
+ """,
74
+ unsafe_allow_html=True
75
+ )
76
+
77
+ # img_background_path = os.path.join(img_path, '01 - background.jpg')
78
+ # # img_background_path = os.path.join(img_path, 'test-02.jpg')
79
  # encoded_string = convert_img_to_base64(img_background_path)
80
  # st.markdown(
81
  # f"""
82
  # <style>
83
  # .stApp {{
84
  # background-image: url(data:image/{"jpg"};base64,{encoded_string.decode()});
85
+ # # background-size: cover;
86
+ # background-size: 180%;
87
+ # background-position: top left;
88
+ # background-repeat: no-repeat;
89
+ # background-attachment: local;
90
  # }}
91
 
92
  # </style>