Spaces:
Sleeping
Sleeping
Roberta2024
commited on
Commit
•
bd89067
1
Parent(s):
35f60b4
Update app.py
Browse files
app.py
CHANGED
@@ -5,54 +5,36 @@ import pandas as pd
|
|
5 |
import base64
|
6 |
import plotly.express as px
|
7 |
|
|
|
8 |
def set_background(image_file):
|
9 |
with open(image_file, "rb") as image_file:
|
10 |
encoded_string = base64.b64encode(image_file.read()).decode()
|
11 |
st.markdown(
|
12 |
f"""
|
13 |
<style>
|
14 |
-
.
|
15 |
background-image: url(data:image/png;base64,{encoded_string});
|
16 |
background-size: cover;
|
17 |
-
background-position: center
|
18 |
-
padding
|
|
|
19 |
}}
|
20 |
</style>
|
21 |
""",
|
22 |
unsafe_allow_html=True
|
23 |
)
|
24 |
|
25 |
-
#
|
26 |
set_background('ddog.png')
|
27 |
|
28 |
-
#
|
29 |
-
st.
|
30 |
|
31 |
# 網址列表
|
32 |
urls = [
|
33 |
'https://www.tw-animal.com/pet/171211/c000196.html',
|
34 |
'https://www.tw-animal.com/pet/171211/c000186.html',
|
35 |
-
|
36 |
-
'https://www.tw-animal.com/pet/171211/c000848.html',
|
37 |
-
'https://www.tw-animal.com/pet/171211/c000045.html',
|
38 |
-
'https://www.tw-animal.com/pet/171211/c001166.html',
|
39 |
-
'https://www.tw-animal.com/pet/171211/c000773.html',
|
40 |
-
'https://www.tw-animal.com/pet/171211/c001038.html',
|
41 |
-
'https://www.tw-animal.com/pet/171211/c000741.html',
|
42 |
-
'https://www.tw-animal.com/pet/171211/c001451.html',
|
43 |
-
'https://www.tw-animal.com/pet/171211/c000102.html',
|
44 |
-
'https://www.tw-animal.com/pet/171211/c000757.html',
|
45 |
-
'https://www.tw-animal.com/pet/171211/c000703.html',
|
46 |
-
'https://www.tw-animal.com/pet/171211/c000481.html',
|
47 |
-
'https://www.tw-animal.com/pet/171211/c000971.html',
|
48 |
-
'https://www.tw-animal.com/pet/171211/c000187.html',
|
49 |
-
'https://www.tw-animal.com/pet/171211/c001357.html',
|
50 |
-
'https://www.tw-animal.com/pet/171211/c001065.html',
|
51 |
-
'https://www.tw-animal.com/pet/171211/c000165.html',
|
52 |
-
'https://www.tw-animal.com/pet/171211/c000217.html',
|
53 |
-
'https://www.tw-animal.com/pet/171211/c000802.html',
|
54 |
-
'https://www.tw-animal.com/pet/171211/c001034.html',
|
55 |
-
'https://www.tw-animal.com/pet/171211/c001453.html'
|
56 |
]
|
57 |
|
58 |
# 讓使用者輸入評分門檻
|
|
|
5 |
import base64
|
6 |
import plotly.express as px
|
7 |
|
8 |
+
# 將背景圖片設置為標題正上方
|
9 |
def set_background(image_file):
|
10 |
with open(image_file, "rb") as image_file:
|
11 |
encoded_string = base64.b64encode(image_file.read()).decode()
|
12 |
st.markdown(
|
13 |
f"""
|
14 |
<style>
|
15 |
+
.title-section {{
|
16 |
background-image: url(data:image/png;base64,{encoded_string});
|
17 |
background-size: cover;
|
18 |
+
background-position: center;
|
19 |
+
padding: 100px;
|
20 |
+
text-align: center;
|
21 |
}}
|
22 |
</style>
|
23 |
""",
|
24 |
unsafe_allow_html=True
|
25 |
)
|
26 |
|
27 |
+
# 設定背景圖片到標題區域
|
28 |
set_background('ddog.png')
|
29 |
|
30 |
+
# 在背景圖片區域內顯示標題
|
31 |
+
st.markdown('<div class="title-section"><h1>寵物診所資訊爬蟲</h1></div>', unsafe_allow_html=True)
|
32 |
|
33 |
# 網址列表
|
34 |
urls = [
|
35 |
'https://www.tw-animal.com/pet/171211/c000196.html',
|
36 |
'https://www.tw-animal.com/pet/171211/c000186.html',
|
37 |
+
# 其餘網址...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
]
|
39 |
|
40 |
# 讓使用者輸入評分門檻
|