Spaces:
Running
Running
import gradio as gr | |
import requests | |
import logging | |
import threading | |
import time | |
# ๋ก๊น ์ค์ | |
logging.basicConfig(level=logging.INFO) | |
css = """ | |
footer { visibility: hidden; } | |
.status-button { | |
display: inline-block; | |
padding: 5px 10px; | |
margin: 5px; | |
border-radius: 5px; | |
font-size: 12px; | |
} | |
.status-normal { background-color: green; color: white; } | |
.status-abnormal { background-color: red; color: white; } | |
""" | |
# ๋ชจ๋ํฐ๋ง ๋์ ๋ชฉ๋ก | |
TARGETS = [ | |
{"name": "[MON]๊ด๋ฆฌ-HOME", "url": "https://seawolf2357-bnews1.hf.space"}, | |
{"name": "[MON]๊ด๋ฆฌ-H100 LIST", "url": "https://seawolf2357-bnews2.hf.space"}, | |
{"name": "[MON]๊ด๋ฆฌ-MONITOR Origin", "url": "https://seawolf2357-bnews3.hf.space"}, | |
{"name": "[MON]ํ์ด๋จธ1-1 ", "url": "https://seawolf2357-timer.hf.space"}, | |
{"name": "[MON]ํ์ด๋จธ1-2 ", "url": "https://seawolf2357-timer2.hf.space"}, | |
{"name": "[MON]ํ์ด๋จธ1-3 ", "url": "https://seawolf2357-timer3.hf.space"}, | |
{"name": "[MON]ํ์ด๋จธ1-4 ", "url": "https://seawolf2357-timer4.hf.space"}, | |
{"name": "[MON]ํ์ด๋จธ2-1 ", "url": "https://fantaxy-timer1.hf.space"}, | |
{"name": "[MON]ํ์ด๋จธ2-2 ", "url": "https://fantaxy-timer2.hf.space"}, | |
{"name": "[H100]AI ๊ฐ์ธ๋น์ JinJAVIS", "url": "http://hugpu.ai:8000"}, | |
{"name": "[H100]์๋ฐํ ์คํ๋์ค ํ๋ซํผ ", "url": "http://hugpu.ai:7899"}, | |
{"name": "[H100]์ํผ ์คํ๋์ค ํ๋ซ", "url": "http://211.233.58.202:7960"}, | |
{"name": "[H100]ํตํฉ Medim ๋ธ๋ก๊ทธ ์์คํ ", "url": "http://hugpu.ai:7917"}, | |
{"name": "[H100]์ด๊ณ ์/ํ ์คํธ ๋ฐ์ ๋ก๊ณ ์์ฑ", "url": "http://hugpu.ai:7897"}, | |
{"name": "[H100]์ฌ์ง+์์ฑ to ๋งํ๋ ์์", "url": "http://hugpu.ai:7895"}, | |
{"name": "[H100]I+T2I ์บ๋ฆญํฐ ํ๋กํ", "url": "http://hugpu.ai:7889"}, | |
{"name": "[H100]๋ชจ์ ๋ฐ๋ผํ๊ธฐ", "url": "http://hugpu.ai:7894"}, | |
{"name": "[H100]์๋ฆฌ๋ฐ๋ฐ 'AnyText'", "url": "http://hugpu.ai:7913"}, | |
{"name": "[@ H100]๋ฉํ ์ค๋ ๋ AUTO", "url": "http://hugpu.ai:7915"}, | |
{"name": "[@ H100]ํจ์ ", "url": "http://hugpu.ai:7896"}, | |
{"name": "[@ H100]Image + Text to Image(IP-ADAPT)", "url": "http://hugpu.ai:7890"}, | |
{"name": "[@ H100]FaceFusion", "url": "http://hugpu.ai:7880"}, | |
{"name": "[HUGPU]FLUX ํ์ฅ ์ด๋ฏธ์ง ์์ฑ", "url": "https://fantaxy-ofai-flx-expl-store.hf.space"}, | |
{"name": "[HUGPU]FLUX GIF ์์ฑ", "url": "https://aiqtech-flxgif.hf.space"}, | |
{"name": "[HUGPU]LOGO ๋์์ธ ์์ฑ ", "url": "https://fantaxy-ofai-flx-logo.hf.space"}, | |
{"name": "[HUGPU]FLUX ํ๋กฌํํธ ์์ฑ ", "url": "https://ginipick-flux-prompt-generator.hf.space"}, | |
{"name": "[HUGPU]LoRA: ๊ธฐ๋ธ๋ฆฌ ์คํ์ผ ", "url": "https://aiqtech-flux-ghibli-studio-lora.hf.space"}, | |
{"name": "[HUGPU]LoRA: ์นดํฐ ์คํ์ผ ", "url": "https://aiqtech-flxani.hf.space"}, | |
{"name": "[HUGPU]FLUX 8step LoRA ์ด๋ฏธ์ง ์์ฑ ", "url": "https://fantos-flx8lora.hf.space"}, | |
{"name": "[HUGPU]FLUX ํ ์คํธ TO ๋น๋์ค ์์ฑ ", "url": "https://fantos-cogvidx.hf.space"}, | |
{"name": "[HUGPU]FLUX ํจ์ ๋ชจ๋ธ ์์ฑ ", "url": "https://fantos-flxfashmodel.hf.space"}, | |
{"name": "[HUGPU]FLUX Controlnet ", "url": "https://fantos-flxcontrol.hf.space"}, | |
{"name": "[HUGPU]FLUX NF4 ์ด๋ฏธ์ง ์์ฑ ", "url": "https://ginipick-ofai-flxnf4.hf.space"}, | |
{"name": "[HUGPU]์ด๋ฏธ์ง์ ํ๊ธ ํ๋กฌํํธ๋ก ์์ ์์ฑ I ", "url": "https://fantaxy-ofai-it2v2.hf.space"}, | |
{"name": "[HUGPU]์ด๋ฏธ์ง์ ํ๊ธ ํ๋กฌํํธ๋ก ์์ ์์ฑ II ", "url": "https://aiqtech-cinevid.hf.space"}, | |
{"name": "[HUGPU]์ํ ์ฌ์ง ์ ๋ก๋+ํ๋กฌํํธ๋ก ๋ฐฐ๊ฒฝ์ ํฉ์ฑ ", "url": "https://aiqtech-producbrmg.hf.space"}, | |
{"name": "[HUGPU]ํ ์คํธ๋ก ์ด๋ฏธ์ง ์์ฑ: Accracy ๋ชจ๋ธ ", "url": "https://ginipick-accdiffusion.hf.space"}, | |
{"name": "[HUGPU]ํ ์คํธ๋ก ์ด๋ฏธ์ง ์์ฑ: Playground ๋ชจ๋ธ ", "url": "https://fantaxy-playground25.hf.space"}, | |
{"name": "[HUGPU]ํ ์คํธ๋ก ์ด๋ฏธ์ง ์์ฑ: AuraFlow ๋ชจ๋ธ ", "url": "https://fantaxy-auroflow-v3.hf.space"}, | |
{"name": "[HUGPU]EveryText: ๋ชจ๋ ๋ฌธ์๊ฐ ์ด๋ฏธ์ง ์์ฑ์ ๋ฐ์ ", "url": "https://fantos-EveryText.hf.space"}, | |
{"name": "[HUGPU]๋ด ์ผ๊ตด ์ฌ์ง์ผ๋ก ์ด๋ฏธ์ง ์์ฑ ", "url": "https://aiqtech-kofaceid.hf.space"}, | |
{"name": "[HUGPU]๋น๋์ค ์ธ์ QnA ์ฑ๋ด ", "url": "https://ginipick-vidiqa.hf.space"}, | |
{"name": "[HUGPU]์ด๋ฏธ์ง ์ค์ผ์ผ์ (ํ์ง๊ฐ์ ) ", "url": "https://ginipick-finegrain-image-enhancer.hf.space"}, | |
{"name": "[HUGPU]์ด๋ฏธ์ง ๋ฐฐ๊ฒฝ ์ ๊ฑฐ ", "url": "https://ginipick-background-removal.hf.space"}, | |
{"name": "[HUGPU]๋น๋์ค ๋ฐฐ๊ฒฝ ์ ๊ฑฐ ", "url": "https://fantaxy-remove-video-background.hf.space"}, | |
{"name": "[HUGPU]ํ ์คํธ ์ ๋ ฅ์ผ๋ก ์์ ์์ฑ ", "url": "https://fantaxy-stable-audio-open-zero.hf.space"}, | |
{"name": "[HUGPU]MS PHI 3.5 Vision ", "url": "https://aiqtech-phi35-vision.hf.space"}, | |
{"name": "[HUGPU]NSFW kAI ", "url": "https://fantaxy-ofai-kai.hf.space"}, | |
{"name": "[HUGPU]๋ฉํ LLAMA 3.1 405B ", "url": "https://seawolf2357-ofai-405.hf.space"}, | |
{"name": "[HUGPU]๋ฉํ LLAMA 3.1 70B ", "url": "https://fantaxy-ofai-70.hf.space"}, | |
{"name": "[HUGPU]๋ฉํ LLAMA 3.1 8B ", "url": "https://seawolf2357-ofai-8.hf.space"}, | |
{"name": "[HUGPU]๋ฏธ์คํธ๋ 7B Instruct v0.3 ", "url": "https://fantaxy-ofai-mis7b.hf.space"}, | |
{"name": "[HUGPU]MS Phi 3 mini 4k-instruct ", "url": "https://fantaxy-ofai-phi.hf.space"}, | |
{"name": "[HUGPU]์ค๊ตญ Yi 1.5 34B ", "url": "https://fantaxy-ofai-yi.hf.space"}, | |
{"name": "[HUGPU]๋ฏธ์คํธ๋ Mixtral 8X7B ", "url": "https://fantaxy-ofai-8x7b.hf.space"}, | |
{"name": "[HUGPU]๋ฏธ์คํธ๋ Nemo Instruct 2407 ", "url": "https://seawolf2357-ofai-mistral-nemo.hf.space"}, | |
{"name": "[HUGPU]๋ธ๋ก๊ทธ ์๋(์ปจํ/๋จ์) ์์ฑ ", "url": "https://fantaxy-blogger-send-webhook-confirm-image.hf.space"}, | |
{"name": "[HUGPU]๋ธ๋ก๊ทธ ์๋(๋ฌด์ธ/๋ณต์) ์์ฑ ", "url": "https://fantaxy-blogger-send-webhook-auto-image.hf.space"}, | |
{"name": "[HUGPU]์ ๋ฌธ ๋ธ๋ก๊ทธ ์์ฑ ", "url": "https://seawolf2357-ofai-jinjavis-blog.hf.space"}, | |
{"name": "[HUGPU]์ํ ์ ๋ฌธ ๋ธ๋ก๊ทธ ์์ฑ ", "url": "https://seawolf2357-ofai-jinjavis-blog-medi.hf.space"}, | |
{"name": "[HUGPU]์ฝ๋ฆฌํ ์ ๋ฌธ ๋ธ๋ก๊ทธ ์์ฑ ", "url": "https://seawolf2357-ofai-jinjavis-blog-pharm.hf.space"}, | |
] | |
# URL ์ํ ํ์ธ ํจ์ | |
def check_url_status(url): | |
try: | |
response = requests.get(url, timeout=5) | |
if response.status_code == 200: | |
logging.info(f"URL ์ ์ ์ฑ๊ณต: {url}") | |
return "์ ์", "normal" | |
else: | |
logging.error(f"URL ์ ์ ์ค๋ฅ: {url}, ์ํ ์ฝ๋ {response.status_code}") | |
return "๋น์ ์", "abnormal" | |
except requests.exceptions.RequestException as e: | |
logging.exception(f"์๋ฒ์ ์ฐ๊ฒฐํ ์ ์์ต๋๋ค: {url}") | |
return "๋น์ ์", "abnormal" | |
# ์ํ ์ ๋ฐ์ดํธ ํจ์ | |
def update_status(): | |
status_html = "" | |
for target in TARGETS: | |
status, status_class = check_url_status(target["url"]) | |
status_html += f'<span class="status-button status-{status_class}">{target["name"]}: {status}</span>' | |
return status_html | |
# ์ฃผ๊ธฐ์ ์ ๋ฐ์ดํธ๋ฅผ ์ํ ํจ์ | |
def periodic_update(status_html): | |
while True: | |
time.sleep(60) # 10์ด ๋๊ธฐ | |
new_status = update_status() | |
status_html.update(value=new_status) | |
# Gradio ์ธํฐํ์ด์ค ์ค์ | |
def create_dashboard(): | |
with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as app: | |
gr.Image("banner.png", show_label=False) | |
gr.Markdown("# 24์๊ฐ ๋ชจ๋ํฐ๋ง ์์คํ ") | |
gr.Markdown("## \n") | |
status_html = gr.HTML() | |
refresh_button = gr.Button("์ํ ์๋ก๊ณ ์นจ") | |
refresh_button.click(fn=update_status, outputs=status_html) | |
# ์ด๊ธฐ ์ํ ์ ๋ฐ์ดํธ | |
app.load(fn=update_status, outputs=status_html) | |
# ๋ฐฑ๊ทธ๋ผ์ด๋์์ ์ฃผ๊ธฐ์ ์ ๋ฐ์ดํธ ์์ | |
threading.Thread(target=periodic_update, args=(status_html,), daemon=True).start() | |
return app | |
if __name__ == "__main__": | |
dashboard = create_dashboard() | |
dashboard.launch() |