JAMESPARK3 commited on
Commit
16b9ba8
·
verified ·
1 Parent(s): 30addd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -25
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import streamlit as st
2
  import requests
3
  import xml.etree.ElementTree as ET
 
4
 
5
  RSS_FEED_URL = "http://www.yonhapnewstv.co.kr/category/news/headline/feed/"
6
 
@@ -38,7 +39,7 @@ def display_news():
38
  url = item.get('url', '#') # 기사 URL이 없으면 기본 링크는 '#'
39
  st.markdown(f'''
40
  <div class="headline-container">
41
- <a href="{url}" target="_blank" style="text-decoration: none;">
42
  <div class="headline-text">{original_title}</div>
43
  </a>
44
  </div>
@@ -48,7 +49,7 @@ def main():
48
  """앱 메인 함수"""
49
  st.set_page_config(layout="wide")
50
 
51
- st.markdown("""
52
  <style>
53
  .headline-container {
54
  background-color: rgba(255, 255, 255, 0.9);
@@ -62,6 +63,7 @@ def main():
62
  font-size: 40px;
63
  font-weight: bold;
64
  font-family: 'Noto Sans KR', sans-serif;
 
65
  }
66
  .stApp {
67
  background-image: url("https://huggingface.co/spaces/JAMESPARK3/headlineai/resolve/main/news.jpg");
@@ -69,33 +71,19 @@ def main():
69
  background-repeat: no-repeat;
70
  background-position: center;
71
  }
72
- #clock-container {
73
- position: fixed;
74
- bottom: 0;
75
- left: 0;
76
- right: 0;
77
- z-index: 1000;
78
- width: 100%;
79
- max-width: 1200px;
80
- margin: 0 auto;
81
- padding: 0 20px;
82
- text-align: center;
83
- height: 300px;
84
- display: flex;
85
- align-items: center;
86
- justify-content: center;
87
- }
88
- #clock {
89
- font-size: 15em;
90
- font-weight: bold;
91
- color: black;
92
- line-height: 1.2;
93
- white-space: nowrap;
94
- }
95
  </style>
96
  """, unsafe_allow_html=True)
97
 
98
  display_news()
99
 
 
 
 
 
 
 
 
 
 
100
  if __name__ == "__main__":
101
  main()
 
1
  import streamlit as st
2
  import requests
3
  import xml.etree.ElementTree as ET
4
+ import time
5
 
6
  RSS_FEED_URL = "http://www.yonhapnewstv.co.kr/category/news/headline/feed/"
7
 
 
39
  url = item.get('url', '#') # 기사 URL이 없으면 기본 링크는 '#'
40
  st.markdown(f'''
41
  <div class="headline-container">
42
+ <a href="{url}" target="_blank" style="text-decoration: none; pointer-events: auto;">
43
  <div class="headline-text">{original_title}</div>
44
  </a>
45
  </div>
 
49
  """앱 메인 함수"""
50
  st.set_page_config(layout="wide")
51
 
52
+ st.markdown("""
53
  <style>
54
  .headline-container {
55
  background-color: rgba(255, 255, 255, 0.9);
 
63
  font-size: 40px;
64
  font-weight: bold;
65
  font-family: 'Noto Sans KR', sans-serif;
66
+ pointer-events: auto; /* 클릭 가능하도록 설정 */
67
  }
68
  .stApp {
69
  background-image: url("https://huggingface.co/spaces/JAMESPARK3/headlineai/resolve/main/news.jpg");
 
71
  background-repeat: no-repeat;
72
  background-position: center;
73
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  </style>
75
  """, unsafe_allow_html=True)
76
 
77
  display_news()
78
 
79
+ # 새로고침 타이머 설정
80
+ if 'last_run' not in st.session_state:
81
+ st.session_state.last_run = time.time()
82
+
83
+ current_time = time.time()
84
+ if current_time - st.session_state.last_run >= 3600: # 1시간 경과
85
+ st.session_state.last_run = current_time
86
+ st.rerun() # 새로고침
87
+
88
  if __name__ == "__main__":
89
  main()