seawolf2357 commited on
Commit
bd1bd4c
ยท
verified ยท
1 Parent(s): d22afc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +143 -18
app.py CHANGED
@@ -1,9 +1,23 @@
1
  import gradio as gr
 
 
 
 
 
 
 
2
 
3
  css = """
4
- footer {
5
- visibility: hidden;
 
 
 
 
 
6
  }
 
 
7
  """
8
 
9
  def create_home_screen():
@@ -48,23 +62,134 @@ def create_home_screen():
48
 
49
  gr.Markdown("## \n")
50
 
51
- # Discord iframe as another column
52
- with gr.Row():
53
 
54
- with gr.Column(scale=1):
55
- gr.HTML("""
56
- <iframe src="https://discord.com/widget?id=1228254992729767996&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>
57
- """)
58
-
59
- with gr.Column(scale=2):
60
- gr.Markdown("""
61
- ### ๋””์Šค์ฝ”๋“œ ์„œ๋ฒ„ ์ฐธ์—ฌ
62
- ๐Ÿค– ๋””์Šค์ฝ”๋“œ ์„œ๋ฒ„์— ์ฐธ์—ฌํ•˜๋ฉด ๋”์šฑ ๋‹ค์–‘ํ•œ 90์ข… ์ด์ƒ์˜ AI ์„œ๋น„์Šค๋ฅผ ๋งŒ๋‚  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. \n
63
- ๐Ÿค– ์ขŒ์ธก ํ™”๋ฉด ํ•˜๋‹จ "Join Discord"๋ฅผ ํด๋ฆญํ•˜์„ธ์š”. \n
64
- """)
65
  return home
66
 
67
- if __name__ == "__main__":
68
- home = create_home_screen()
69
- home.launch()
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import requests
3
+ import logging
4
+ import threading
5
+ import time
6
+
7
+ # ๋กœ๊น… ์„ค์ •
8
+ logging.basicConfig(level=logging.INFO)
9
 
10
  css = """
11
+ footer { visibility: hidden; }
12
+ .status-button {
13
+ display: inline-block;
14
+ padding: 5px 10px;
15
+ margin: 5px;
16
+ border-radius: 5px;
17
+ font-size: 12px;
18
  }
19
+ .status-normal { background-color: green; color: white; }
20
+ .status-abnormal { background-color: red; color: white; }
21
  """
22
 
23
  def create_home_screen():
 
62
 
63
  gr.Markdown("## \n")
64
 
 
 
65
 
66
+
67
+ # with gr.Column(scale=1):
68
+ # gr.HTML("""
69
+ # <iframe src="https://discord.com/widget?id=1228254992729767996&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>
70
+ # """)
71
+
 
 
 
 
 
72
  return home
73
 
 
 
 
74
 
75
+
76
+
77
+ # ๋ชจ๋‹ˆํ„ฐ๋ง ๋Œ€์ƒ ๋ชฉ๋ก
78
+ TARGETS = [
79
+ {"name": "[H100]AI ๊ฐœ์ธ๋น„์„œ JinJAVIS", "url": "http://hugpu.ai:8000"},
80
+ {"name": "[H100]ํ†ตํ•ฉ Medim ๋ธ”๋กœ๊ทธ ์‹œ์Šคํ…œ ", "url": "http://hugpu.ai:7917"},
81
+
82
+ {"name": "[HUGPU]๊ด€๋ฆฌ-HOME", "url": "https://seawolf2357-bnews1.hf.space"},
83
+ {"name": "[HUGPU]๊ด€๋ฆฌ-H100 LIST", "url": "https://seawolf2357-bnews2.hf.space"},
84
+ {"name": "[HUGPU]๊ด€๋ฆฌ-MONITOR Origin", "url": "https://seawolf2357-bnews3.hf.space"},
85
+
86
+ {"name": "[HUGPU]๊ด€๋ฆฌ-MONITOR Cross", "url": "https://seawolf2357-bnews4.hf.space"}, # ๋ชจ๋‹ˆํ„ฐ์˜ค๋ฆฌ์ง„ ๊ฐ์‹œ ์„ค์ • ํ•„์š”
87
+
88
+ {"name": "[HUGPU]FLUX ํ™•์žฅ ์ด๋ฏธ์ง€ ์ƒ์„ฑ", "url": "https://fantaxy-ofai-flx-expl-store.hf.space"},
89
+ {"name": "[HUGPU]FLUX GIF ์ƒ์„ฑ", "url": "https://aiqtech-flxgif.hf.space"},
90
+ {"name": "[HUGPU]LOGO ๋””์ž์ธ ์ƒ์„ฑ ", "url": "https://fantaxy-ofai-flx-logo.hf.space"},
91
+ {"name": "[HUGPU]FLUX ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ ", "url": "https://ginipick-flux-prompt-generator.hf.space"},
92
+ {"name": "[HUGPU]ํ”„๋กฌํ”„ํŠธ+์ด๋ฏธ์ง€๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ ", "url": "https://fantaxy-kolors-ipadapter.hf.space"}, ##์ž˜๋ชป๋œ URL: INDEX.HTML๋„ ์ˆ˜์ •ํ• ๊ฒƒ
93
+ {"name": "[HUGPU]LoRA: ๊ธฐ๋ธ”๋ฆฌ ์Šคํƒ€์ผ ", "url": "https://aiqtech-flux-ghibli-studio-lora.hf.space"},
94
+ {"name": "[HUGPU]LoRA: ์นดํˆฐ ์Šคํƒ€์ผ ", "url": "https://aiqtech-flxani.hf.space"},
95
+ {"name": "[HUGPU]FLUX 8step LoRA ์ด๋ฏธ์ง€ ์ƒ์„ฑ ", "url": "https://fantos-flx8lora.hf.space"},
96
+ {"name": "[HUGPU]FLUX ํ…์ŠคํŠธ TO ๋น„๋””์˜ค ์ƒ์„ฑ ", "url": "https://fantos-cogvidx.hf.space"},
97
+ {"name": "[HUGPU]FLUX ํŒจ์…˜๋ชจ๋ธ ์ƒ์„ฑ ", "url": "https://fantos-flxfashmodel.hf.space"},
98
+ {"name": "[HUGPU]FLUX Controlnet ", "url": "https://fantos-flxcontrol.hf.space"},
99
+ {"name": "[HUGPU]FLUX NF4 ์ด๋ฏธ์ง€ ์ƒ์„ฑ ", "url": "https://ginipick-ofai-flxnf4.hf.space"},
100
+
101
+ {"name": "[HUGPU]์ด๋ฏธ์ง€์™€ ํ•œ๊ธ€ ํ”„๋กฌํ”„ํŠธ๋กœ ์˜์ƒ ์ƒ์„ฑ I ", "url": "https://fantaxy-ofai-it2v2.hf.space"},
102
+ {"name": "[HUGPU]์ด๋ฏธ์ง€์™€ ํ•œ๊ธ€ ํ”„๋กฌํ”„ํŠธ๋กœ ์˜์ƒ ์ƒ์„ฑ II ", "url": "https://aiqtech-cinevid.hf.space"},
103
+ {"name": "[HUGPU]์ƒํ’ˆ ์‚ฌ์ง„ ์—…๋กœ๋“œ+ํ”„๋กฌํ”„ํŠธ๋กœ ๋ฐฐ๊ฒฝ์„ ํ•ฉ์„ฑ ", "url": "https://aiqtech-producbrmg.hf.space"},
104
+ {"name": "[HUGPU]ํ…์ŠคํŠธ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ: Accracy ๋ชจ๋ธ ", "url": "https://ginipick-accdiffusion.hf.space"},
105
+ {"name": "[HUGPU]ํ…์ŠคํŠธ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ: Playground ๋ชจ๋ธ ", "url": "https://fantaxy-playground25.hf.space"},
106
+ {"name": "[HUGPU]ํ…์ŠคํŠธ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ: AuraFlow ๋ชจ๋ธ ", "url": "https://fantaxy-auroflow-v3.hf.space"},
107
+ {"name": "[HUGPU]EveryText: ๋ชจ๋“  ๋ฌธ์ž๊ฐ€ ์ด๋ฏธ์ง€ ์ƒ์„ฑ์— ๋ฐ˜์˜ ", "url": "https://fantos-EveryText.hf.space"},
108
+ {"name": "[HUGPU]๋‚ด ์–ผ๊ตด ์‚ฌ์ง„์œผ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ ", "url": "https://aiqtech-kofaceid.hf.space"},
109
+
110
+ {"name": "[HUGPU]๋น„๋””์˜ค ์ธ์‹ QnA ์ฑ—๋ด‡ ", "url": "https://ginipick-vidiqa.hf.space"},
111
+ {"name": "[HUGPU]์ด๋ฏธ์ง€ ์Šค์ผ€์ผ์—…(ํ™”์งˆ๊ฐœ์„ ) ", "url": "https://ginipick-finegrain-image-enhancer.hf.space"},
112
+ {"name": "[HUGPU]์ด๋ฏธ์ง€ ๋ฐฐ๊ฒฝ ์ œ๊ฑฐ ", "url": "https://ginipick-background-removal.hf.space"},
113
+ {"name": "[HUGPU]๋น„๋””์˜ค ๋ฐฐ๊ฒฝ ์ œ๊ฑฐ ", "url": "https://fantaxy-remove-video-background.hf.space"},
114
+ {"name": "[HUGPU]ํ…์ŠคํŠธ ์ž…๋ ฅ์œผ๋กœ ์Œ์•… ์ƒ์„ฑ ", "url": "https://fantaxy-stable-audio-open-zero.hf.space"},
115
+
116
+ {"name": "[HUGPU]MS PHI 3.5 Vision ", "url": "https://aiqtech-phi35-vision.hf.space"},
117
+ {"name": "[HUGPU]NSFW kAI ", "url": "https://fantaxy-ofai-kai.hf.space"},
118
+ {"name": "[HUGPU]๋ฉ”ํƒ€ LLAMA 3.1 405B ", "url": "https://seawolf2357-ofai-405.hf.space"},
119
+ {"name": "[HUGPU]๋ฉ”ํƒ€ LLAMA 3.1 70B ", "url": "https://fantaxy-ofai-70.hf.space"},
120
+ {"name": "[HUGPU]๋ฉ”ํƒ€ LLAMA 3.1 8B ", "url": "https://seawolf2357-ofai-8.hf.space"},
121
+ {"name": "[HUGPU]๋ฏธ์ŠคํŠธ๋ž„ 7B Instruct v0.3 ", "url": "https://fantaxy-ofai-mis7b.hf.space"},
122
+ {"name": "[HUGPU]MS Phi 3 mini 4k-instruct ", "url": "https://fantaxy-ofai-phi.hf.space"},
123
+ {"name": "[HUGPU]์ค‘๊ตญ Yi 1.5 34B ", "url": "https://fantaxy-ofai-yi.hf.space"},
124
+ {"name": "[HUGPU]๋ฏธ์ŠคํŠธ๋ž„ Mixtral 8X7B ", "url": "https://fantaxy-ofai-8x7b.hf.space"},
125
+ {"name": "[HUGPU]๋ฏธ์ŠคํŠธ๋ž„ Nemo Instruct 2407 ", "url": "https://seawolf2357-ofai-mistral-nemo.hf.space"},
126
+
127
+ {"name": "[HUGPU]๋ธ”๋กœ๊ทธ ์ž๋™(์ปจํŽŒ/๋‹จ์ˆ˜) ์ƒ์„ฑ ", "url": "https://fantaxy-blogger-send-webhook-confirm-image.hf.space"},
128
+ {"name": "[HUGPU]๋ธ”๋กœ๊ทธ ์ž๋™(๋ฌด์ธ/๋ณต์ˆ˜) ์ƒ์„ฑ ", "url": "https://fantaxy-blogger-send-webhook-auto-image.hf.space"},
129
+
130
+ {"name": "[HUGPU]์ „๋ฌธ ๋ธ”๋กœ๊ทธ ์ƒ์„ฑ ", "url": "https://seawolf2357-ofai-jinjavis-blog.hf.space"},
131
+ {"name": "[HUGPU]์˜ํ•™ ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ์ƒ์„ฑ ", "url": "https://seawolf2357-ofai-jinjavis-blog-medi.hf.space"},
132
+ {"name": "[HUGPU]์•ฝ๋ฆฌํ•™ ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ์ƒ์„ฑ ", "url": "https://seawolf2357-ofai-jinjavis-blog-pharm.hf.space"},
133
+
134
+ {"name": "[HUGPU]ํƒ€์ด๋จธ1-1 ", "url": "https://seawolf2357-timer.hf.space"},
135
+ {"name": "[HUGPU]ํƒ€์ด๋จธ1-2 ", "url": "https://seawolf2357-timer2.hf.space"},
136
+ {"name": "[HUGPU]ํƒ€์ด๋จธ1-3 ", "url": "https://seawolf2357-timer3.hf.space"},
137
+ {"name": "[HUGPU]ํƒ€์ด๋จธ1-4 ", "url": "https://seawolf2357-timer4.hf.space"},
138
+ {"name": "[HUGPU]ํƒ€์ด๋จธ2-1 ", "url": "https://fantaxy-timer1.hf.space"},
139
+ {"name": "[HUGPU]ํƒ€์ด๋จธ2-2 ", "url": "https://fantaxy-timer2.hf.space"},
140
+ ]
141
+
142
+
143
+ # URL ์ƒํƒœ ํ™•์ธ ํ•จ์ˆ˜
144
+ def check_url_status(url):
145
+ try:
146
+ response = requests.get(url, timeout=5)
147
+ if response.status_code == 200:
148
+ logging.info(f"URL ์ ‘์† ์„ฑ๊ณต: {url}")
149
+ return "์ •์ƒ", "normal"
150
+ else:
151
+ logging.error(f"URL ์ ‘์† ์˜ค๋ฅ˜: {url}, ์ƒํƒœ ์ฝ”๋“œ {response.status_code}")
152
+ return "๋น„์ •์ƒ", "abnormal"
153
+ except requests.exceptions.RequestException as e:
154
+ logging.exception(f"์„œ๋ฒ„์— ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค: {url}")
155
+ return "๋น„์ •์ƒ", "abnormal"
156
+
157
+ # ์ƒํƒœ ์—…๋ฐ์ดํŠธ ํ•จ์ˆ˜
158
+ def update_status():
159
+ status_html = ""
160
+ for target in TARGETS:
161
+ status, status_class = check_url_status(target["url"])
162
+ status_html += f'<span class="status-button status-{status_class}">{target["name"]}: {status}</span>'
163
+ return status_html
164
+
165
+ # ์ฃผ๊ธฐ์  ์—…๋ฐ์ดํŠธ๋ฅผ ์œ„ํ•œ ํ•จ์ˆ˜
166
+ def periodic_update(status_html):
167
+ while True:
168
+ time.sleep(60) # 10์ดˆ ๋Œ€๊ธฐ
169
+ new_status = update_status()
170
+ status_html.update(value=new_status)
171
+
172
+ # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ •
173
+ def create_dashboard():
174
+ with gr.Blocks(css=css) as app:
175
+ gr.Image("banner.png", show_label=False)
176
+ gr.Markdown("# 24์‹œ๊ฐ„ ๋ชจ๋‹ˆํ„ฐ๋ง ์‹œ์Šคํ…œ")
177
+ gr.Markdown("## \n")
178
+
179
+ status_html = gr.HTML()
180
+
181
+ refresh_button = gr.Button("์ƒํƒœ ์ƒˆ๋กœ๊ณ ์นจ")
182
+ refresh_button.click(fn=update_status, outputs=status_html)
183
+
184
+ # ์ดˆ๊ธฐ ์ƒํƒœ ์—…๋ฐ์ดํŠธ
185
+ app.load(fn=update_status, outputs=status_html)
186
+
187
+ # ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ์ฃผ๊ธฐ์  ์—…๋ฐ์ดํŠธ ์‹œ์ž‘
188
+ threading.Thread(target=periodic_update, args=(status_html,), daemon=True).start()
189
+
190
+ return app
191
+
192
+
193
+ if __name__ == "__main__":
194
+ dashboard = create_dashboard()
195
+ dashboard.launch()