Spaces:
Sleeping
Sleeping
Roberta2024
commited on
Commit
•
2e9261c
1
Parent(s):
bd89067
Update app.py
Browse files
app.py
CHANGED
@@ -5,36 +5,54 @@ import pandas as pd
|
|
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 |
-
.
|
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.
|
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 |
# 讓使用者輸入評分門檻
|
@@ -127,4 +145,4 @@ if st.button('傳送至 LINE'):
|
|
127 |
else:
|
128 |
st.error('傳送失敗,請檢查您的權杖是否正確。')
|
129 |
else:
|
130 |
-
st.warning('沒有資料可以傳送,請先執行爬蟲。')
|
|
|
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 |
+
.stApp {{
|
15 |
background-image: url(data:image/png;base64,{encoded_string});
|
16 |
background-size: cover;
|
17 |
+
background-position: center top;
|
18 |
+
padding-top: 100px;
|
|
|
19 |
}}
|
20 |
</style>
|
21 |
""",
|
22 |
unsafe_allow_html=True
|
23 |
)
|
24 |
|
25 |
+
# 設定背景圖片
|
26 |
set_background('ddog.png')
|
27 |
|
28 |
+
# Streamlit app 標題
|
29 |
+
st.title('寵物診所資訊爬蟲')
|
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 |
+
'https://www.tw-animal.com/pet/171211/c000081.html',
|
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 |
# 讓使用者輸入評分門檻
|
|
|
145 |
else:
|
146 |
st.error('傳送失敗,請檢查您的權杖是否正確。')
|
147 |
else:
|
148 |
+
st.warning('沒有資料可以傳送,請先執行爬蟲。')
|