seawolf2357 commited on
Commit
2c783de
ยท
verified ยท
1 Parent(s): 0d459cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -21
app.py CHANGED
@@ -20,7 +20,6 @@ footer { visibility: hidden; }
20
  .status-abnormal { background-color: red; color: white; }
21
  """
22
 
23
-
24
  # ๋ชจ๋‹ˆํ„ฐ๋ง ๋Œ€์ƒ ๋ชฉ๋ก
25
  TARGETS = [
26
  {"name": "[MON]๊ด€๋ฆฌ-HOME", "url": "https://seawolf2357-bnews1.hf.space"},
@@ -76,7 +75,7 @@ TARGETS = [
76
  {"name": "[HUGPU]EveryText: ๋ชจ๋“  ๋ฌธ์ž๊ฐ€ ์ด๋ฏธ์ง€ ์ƒ์„ฑ์— ๋ฐ˜์˜ ", "url": "https://fantos-EveryText.hf.space"},
77
  {"name": "[HUGPU]๋‚ด ์–ผ๊ตด ์‚ฌ์ง„์œผ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ I", "url": "https://aiqtech-kofaceid.hf.space"},
78
  {"name": "[HUGPU]๋‚ด ์–ผ๊ตด ์‚ฌ์ง„์œผ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ II", "url": "https://aiqtech-sdfacid.hf.space"},
79
- {"name": "[HUGPU]๊ณ ํ•ด์ƒ๋„ ์ด๋ฏธ์ง€ ์ƒ์„ฑ REALVISXL V5", "url": "https://seawolf2357-REALVISXL-V5.hf.space"},
80
 
81
  {"name": "[HUGPU]ํ…์ŠคํŠธ๋กœ ๊ฐ์ฒด๋งŒ ์ž˜๋ผ๋‚ด๊ณ  ๋ฐฐ๊ฒฝ ํˆฌ๋ช…ํ™”", "url": "https://fantos-textcutobject.hf.space"},
82
  {"name": "[HUGPU]๋น„๋””์˜ค ์ธ์‹ QnA ์ฑ—๋ด‡ ", "url": "https://ginipick-vidiqa.hf.space"},
@@ -105,6 +104,7 @@ TARGETS = [
105
 
106
  ]
107
 
 
108
  # URL ์ƒํƒœ ํ™•์ธ ํ•จ์ˆ˜
109
  def check_url_status(url):
110
  try:
@@ -127,27 +127,33 @@ def update_status():
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)
 
 
20
  .status-abnormal { background-color: red; color: white; }
21
  """
22
 
 
23
  # ๋ชจ๋‹ˆํ„ฐ๋ง ๋Œ€์ƒ ๋ชฉ๋ก
24
  TARGETS = [
25
  {"name": "[MON]๊ด€๋ฆฌ-HOME", "url": "https://seawolf2357-bnews1.hf.space"},
 
75
  {"name": "[HUGPU]EveryText: ๋ชจ๋“  ๋ฌธ์ž๊ฐ€ ์ด๋ฏธ์ง€ ์ƒ์„ฑ์— ๋ฐ˜์˜ ", "url": "https://fantos-EveryText.hf.space"},
76
  {"name": "[HUGPU]๋‚ด ์–ผ๊ตด ์‚ฌ์ง„์œผ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ I", "url": "https://aiqtech-kofaceid.hf.space"},
77
  {"name": "[HUGPU]๋‚ด ์–ผ๊ตด ์‚ฌ์ง„์œผ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ II", "url": "https://aiqtech-sdfacid.hf.space"},
78
+ # {"name": "[HUGPU]๊ณ ํ•ด์ƒ๋„ ์ด๋ฏธ์ง€ ์ƒ์„ฑ REALVISXL V5", "url": "https://seawolf2357-REALVISXL-V5.hf.space"},
79
 
80
  {"name": "[HUGPU]ํ…์ŠคํŠธ๋กœ ๊ฐ์ฒด๋งŒ ์ž˜๋ผ๋‚ด๊ณ  ๋ฐฐ๊ฒฝ ํˆฌ๋ช…ํ™”", "url": "https://fantos-textcutobject.hf.space"},
81
  {"name": "[HUGPU]๋น„๋””์˜ค ์ธ์‹ QnA ์ฑ—๋ด‡ ", "url": "https://ginipick-vidiqa.hf.space"},
 
104
 
105
  ]
106
 
107
+
108
  # URL ์ƒํƒœ ํ™•์ธ ํ•จ์ˆ˜
109
  def check_url_status(url):
110
  try:
 
127
  status_html += f'<span class="status-button status-{status_class}">{target["name"]}: {status}</span>'
128
  return status_html
129
 
130
+ # ์ฃผ๊ธฐ์  ์—…๋ฐ์ดํŠธ๋ฅผ ์œ„ํ•œ ํ•จ์ˆ˜
131
+ def periodic_update(status_html):
132
+ while True:
133
+ time.sleep(60) # 10์ดˆ ๋Œ€๊ธฐ
134
+ new_status = update_status()
135
+ status_html.update(value=new_status)
 
 
 
 
136
 
137
+ # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ •
138
+ def create_dashboard():
139
+ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as app:
140
+ gr.Image("banner.png", show_label=False)
141
+ gr.Markdown("# 24์‹œ๊ฐ„ ๋ชจ๋‹ˆํ„ฐ๋ง ์‹œ์Šคํ…œ")
142
+ gr.Markdown("## \n")
143
+
144
+ status_html = gr.HTML()
145
+
146
+ refresh_button = gr.Button("์ƒํƒœ ์ƒˆ๋กœ๊ณ ์นจ")
147
+ refresh_button.click(fn=update_status, outputs=status_html)
148
 
149
+ # ์ดˆ๊ธฐ ์ƒํƒœ ์—…๋ฐ์ดํŠธ
150
+ app.load(fn=update_status, outputs=status_html)
 
 
 
151
 
152
+ # ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ์ฃผ๊ธฐ์  ์—…๋ฐ์ดํŠธ ์‹œ์ž‘
153
+ threading.Thread(target=periodic_update, args=(status_html,), daemon=True).start()
154
+
155
+ return app
156
 
157
  if __name__ == "__main__":
158
+ dashboard = create_dashboard()
159
+ dashboard.launch()