Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,7 @@ footer { visibility: hidden; }
|
|
20 |
.status-abnormal { background-color: red; color: white; }
|
21 |
"""
|
22 |
|
|
|
23 |
# ๋ชจ๋ํฐ๋ง ๋์ ๋ชฉ๋ก
|
24 |
TARGETS = [
|
25 |
{"name": "[MON]๊ด๋ฆฌ-HOME", "url": "https://seawolf2357-bnews1.hf.space"},
|
@@ -126,32 +127,27 @@ def update_status():
|
|
126 |
status_html += f'<span class="status-button status-{status_class}">{target["name"]}: {status}</span>'
|
127 |
return status_html
|
128 |
|
129 |
-
#
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
gr.Image("banner.png", show_label=False)
|
139 |
-
gr.Markdown("# 24์๊ฐ ๋ชจ๋ํฐ๋ง ์์คํ
")
|
140 |
-
gr.Markdown("## \n")
|
141 |
-
|
142 |
-
status_html = gr.HTML()
|
143 |
-
|
144 |
-
refresh_button = gr.Button("์ํ ์๋ก๊ณ ์นจ")
|
145 |
-
refresh_button.click(fn=update_status, outputs=status_html)
|
146 |
|
147 |
-
|
148 |
-
|
|
|
|
|
|
|
149 |
|
150 |
-
|
151 |
-
threading.Thread(target=periodic_update, args=(status_html,), daemon=True).start()
|
152 |
-
|
153 |
-
return interface
|
154 |
|
155 |
if __name__ == "__main__":
|
156 |
-
|
157 |
-
dashboard.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
20 |
.status-abnormal { background-color: red; color: white; }
|
21 |
"""
|
22 |
|
23 |
+
|
24 |
# ๋ชจ๋ํฐ๋ง ๋์ ๋ชฉ๋ก
|
25 |
TARGETS = [
|
26 |
{"name": "[MON]๊ด๋ฆฌ-HOME", "url": "https://seawolf2357-bnews1.hf.space"},
|
|
|
127 |
status_html += f'<span class="status-button status-{status_class}">{target["name"]}: {status}</span>'
|
128 |
return status_html
|
129 |
|
130 |
+
# Gradio ์ธํฐํ์ด์ค ์์ฑ
|
131 |
+
with gr.Blocks(css=css) as demo:
|
132 |
+
gr.HTML("<img src='file/banner.png' alt='Banner'>")
|
133 |
+
gr.Markdown("# 24์๊ฐ ๋ชจ๋ํฐ๋ง ์์คํ
")
|
134 |
+
gr.Markdown("## \n")
|
135 |
+
|
136 |
+
status_html = gr.HTML()
|
137 |
+
|
138 |
+
refresh_button = gr.Button("์ํ ์๋ก๊ณ ์นจ")
|
139 |
+
refresh_button.click(fn=update_status, outputs=status_html)
|
140 |
|
141 |
+
# ์ด๊ธฐ ์ํ ์
๋ฐ์ดํธ ๋ฐ ์ฃผ๊ธฐ์ ์
๋ฐ์ดํธ
|
142 |
+
demo.load(fn=update_status, outputs=status_html)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
+
def periodic_update():
|
145 |
+
while True:
|
146 |
+
time.sleep(60) # 60์ด ๋๊ธฐ
|
147 |
+
new_status = update_status()
|
148 |
+
status_html.update(value=new_status)
|
149 |
|
150 |
+
threading.Thread(target=periodic_update, daemon=True).start()
|
|
|
|
|
|
|
151 |
|
152 |
if __name__ == "__main__":
|
153 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|