themeetjani commited on
Commit
890a566
1 Parent(s): 990b582

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -0
app.py CHANGED
@@ -10,7 +10,47 @@ st.set_page_config(
10
  st.markdown("<h1 style='text-align: center; color: black;'> Welcome to DataAI! 👋</h1>", unsafe_allow_html=True)
11
 
12
  st.sidebar.success("Select a demo above.")
 
 
 
 
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  st.markdown("<h2 style='text-align: center; color: black;'>This is the demo for the usecases we've worked on.</h1>", unsafe_allow_html=True)
15
 
16
  st.markdown("<h3 style='text-align: center; color: black;'>Select a demo from the sidebar to see some examples of what we can do!!! </h2>", unsafe_allow_html=True)
 
10
  st.markdown("<h1 style='text-align: center; color: black;'> Welcome to DataAI! 👋</h1>", unsafe_allow_html=True)
11
 
12
  st.sidebar.success("Select a demo above.")
13
+ def get_base64_of_bin_file(png_file):
14
+ with open(png_file, "rb") as f:
15
+ data = f.read()
16
+ return base64.b64encode(data).decode()
17
 
18
+
19
+ def build_markup_for_logo(
20
+ png_file,
21
+ background_position="50% 10%",
22
+ margin_top="10%",
23
+ image_width="60%",
24
+ image_height="",
25
+ ):
26
+ binary_string = get_base64_of_bin_file(png_file)
27
+ return """
28
+ <style>
29
+ [data-testid="stSidebarNav"] {
30
+ background-image: url("data:image/png;base64,%s");
31
+ background-repeat: no-repeat;
32
+ background-position: %s;
33
+ margin-top: %s;
34
+ background-size: %s %s;
35
+ }
36
+ </style>
37
+ """ % (
38
+ binary_string,
39
+ background_position,
40
+ margin_top,
41
+ image_width,
42
+ image_height,
43
+ )
44
+
45
+
46
+ def add_logo(png_file):
47
+ logo_markup = build_markup_for_logo(png_file)
48
+ st.markdown(
49
+ logo_markup,
50
+ unsafe_allow_html=True,
51
+ )
52
+
53
+ add_logo("img/logoo.png")
54
  st.markdown("<h2 style='text-align: center; color: black;'>This is the demo for the usecases we've worked on.</h1>", unsafe_allow_html=True)
55
 
56
  st.markdown("<h3 style='text-align: center; color: black;'>Select a demo from the sidebar to see some examples of what we can do!!! </h2>", unsafe_allow_html=True)