ashok2216 commited on
Commit
83caf2e
·
verified ·
1 Parent(s): befb2f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -0
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import pandas as pd
2
  import streamlit as st
3
  import seaborn as sns
@@ -5,6 +6,42 @@ from data_cleaning import preprocess
5
  from transformers import pipeline
6
  from data_integration import scrape_all_pages
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  # st.image("logo.png", width=200, height=200)
9
  st.image("logo.png", width=100)
10
  st.subheader(':blue[NLP HUB®]')
 
1
+ import base64
2
  import pandas as pd
3
  import streamlit as st
4
  import seaborn as sns
 
6
  from transformers import pipeline
7
  from data_integration import scrape_all_pages
8
 
9
+ @st.cache_data
10
+ def get_img_as_base64(file):
11
+ with open(file, "rb") as f:
12
+ data = f.read()
13
+ return base64.b64encode(data).decode()
14
+
15
+
16
+ img = get_img_as_base64("image.jpg")
17
+
18
+ page_bg_img = f"""
19
+ <style>
20
+ [data-testid="stAppViewContainer"] > .main {{
21
+ background-image: url("https://images.unsplash.com/photo-1501426026826-31c667bdf23d");
22
+ background-size: 180%;
23
+ background-position: top left;
24
+ background-repeat: no-repeat;
25
+ background-attachment: local;
26
+ }}
27
+
28
+ [data-testid="stSidebar"] > div:first-child {{
29
+ background-image: url("data:image/png;base64,{img}");
30
+ background-position: center;
31
+ background-repeat: no-repeat;
32
+ background-attachment: fixed;
33
+ }}
34
+
35
+ [data-testid="stHeader"] {{
36
+ background: rgba(0,0,0,0);
37
+ }}
38
+
39
+ [data-testid="stToolbar"] {{
40
+ right: 2rem;
41
+ }}
42
+ </style>
43
+ """
44
+
45
  # st.image("logo.png", width=200, height=200)
46
  st.image("logo.png", width=100)
47
  st.subheader(':blue[NLP HUB®]')