bnews3 / app.py
seawolf2357's picture
Update app.py
703aa27 verified
import gradio as gr
import requests
import logging
import threading
import time
from pydantic import BaseModel, ConfigDict
from typing import Any
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;
color: black; /* ๊ธ€์ž ์ƒ‰์ƒ์„ ๊ฒ€์€์ƒ‰์œผ๋กœ ๋ณ€๊ฒฝ */
}
.status-normal { background-color: #90EE90; }
.status-abnormal { background-color: #FFA07A; }
"""
# ๋ชจ๋‹ˆํ„ฐ๋ง ๋Œ€์ƒ ๋ชฉ๋ก
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]AI Playgroud ๋ฉ”๋‰ด", "url": "https://aiqtech-ofai-stream-menu-backup.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": "[OFAI]FLUX ํ™•์žฅ ์ด๋ฏธ์ง€ ์ƒ์„ฑ", "url": "https://fantaxy-ofai-flx-expl-store.hf.space"},
{"name": "[OFAI]FLUX GIF ์ƒ์„ฑ", "url": "https://aiqtech-flxgif.hf.space"},
{"name": "[OFAILOGO ๋””์ž์ธ ์ƒ์„ฑ ", "url": "https://fantaxy-ofai-flx-logo.hf.space"},
{"name": "[OFAI]FLUX ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ ", "url": "https://ginipick-flux-prompt-generator.hf.space"},
{"name": "[OFAI]LoRA: ๊ธฐ๋ธ”๋ฆฌ ์Šคํƒ€์ผ ", "url": "https://aiqtech-flux-ghibli-studio-lora.hf.space"},
{"name": "[OFAI]LoRA: ์นดํˆฐ ์Šคํƒ€์ผ ", "url": "https://aiqtech-flxani.hf.space"},
{"name": "[OFAI]FLUX 8step LoRA ์ด๋ฏธ์ง€ ์ƒ์„ฑ ", "url": "https://fantos-flx8lora.hf.space"},
{"name": "[OFAI]FLUX ํ…์ŠคํŠธ TO ๋น„๋””์˜ค ์ƒ์„ฑ ", "url": "https://fantos-cogvidx.hf.space"},
{"name": "[OFAI]FLUX ํŒจ์…˜๋ชจ๋ธ ์ƒ์„ฑ ", "url": "https://fantos-flxfashmodel.hf.space"},
{"name": "[OFAI]FLUX Controlnet ", "url": "https://fantos-flxcontrol.hf.space"},
{"name": "[OFAI]FLUX NF4 ์ด๋ฏธ์ง€ ์ƒ์„ฑ ", "url": "https://ginipick-ofai-flxnf4.hf.space"},
{"name": "[OFAI]FLUX LoRA ์ŠคํŠœ๋””์˜ค #1๋ฒˆ ์„œ๋ฒ„ ", "url": "https://seawolf2357-flxloraexp.hf.space"},
{"name": "[OFAI]FLUX LoRA ์ŠคํŠœ๋””์˜ค #2๋ฒˆ ์„œ๋ฒ„ ", "url": "https://fantaxy-flxloraexp.hf.space"},
{"name": "[OFAI]FLUX LoRA ์ŠคํŠœ๋””์˜ค #3๋ฒˆ ์„œ๋ฒ„ ", "url": "https://fantos-flxloraexp.hf.space"},
{"name": "[OFAI]FLUX LoRA ์ŠคํŠœ๋””์˜ค #4๋ฒˆ ์„œ๋ฒ„", "url": "https://ginipick-flxloraexp.hf.space"},
{"name": "[OFAI]์ด๋ฏธ์ง€์™€ ํ•œ๊ธ€ ํ”„๋กฌํ”„ํŠธ๋กœ ์˜์ƒ ์ƒ์„ฑ I ", "url": "https://fantaxy-ofai-it2v2.hf.space"},
{"name": "[OFAI]์ด๋ฏธ์ง€์™€ ํ•œ๊ธ€ ํ”„๋กฌํ”„ํŠธ๋กœ ์˜์ƒ ์ƒ์„ฑ II ", "url": "https://aiqtech-cinevid.hf.space"},
{"name": "[OFAI]์ด๋ฏธ์ง€์™€ ํ•œ๊ธ€ ํ”„๋กฌํ”„ํŠธ๋กœ ์ด๋ฏธ์ง€ ๋ณ€ํ˜•", "url": "https://fantos-kolcontrl.hf.space"},
{"name": "[OFAI]์ƒํ’ˆ ์‚ฌ์ง„ ์—…๋กœ๋“œ+ํ”„๋กฌํ”„ํŠธ๋กœ ๋ฐฐ๊ฒฝ์„ ํ•ฉ์„ฑ ", "url": "https://aiqtech-producbrmg.hf.space"},
{"name": "[OFAI]ํ…์ŠคํŠธ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ: Accracy ๋ชจ๋ธ ", "url": "https://ginipick-accdiffusion.hf.space"},
{"name": "[OFAI]ํ…์ŠคํŠธ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ: Playground ๋ชจ๋ธ ", "url": "https://fantaxy-playground25.hf.space"},
{"name": "[OFAI]ํ…์ŠคํŠธ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ: AuraFlow ๋ชจ๋ธ ", "url": "https://fantaxy-auroflow-v3.hf.space"},
{"name": "[OFAI]EveryText: ๋ชจ๋“  ๋ฌธ์ž๊ฐ€ ์ด๋ฏธ์ง€ ์ƒ์„ฑ์— ๋ฐ˜์˜ ", "url": "https://fantos-EveryText.hf.space"},
{"name": "[OFAI]๋‚ด ์–ผ๊ตด ์‚ฌ์ง„์œผ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ I", "url": "https://aiqtech-kofaceid.hf.space"},
{"name": "[OFAI]๋‚ด ์–ผ๊ตด ์‚ฌ์ง„์œผ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ II", "url": "https://aiqtech-sdfacid.hf.space"},
{"name": "[OFAI]๊ณ ํ•ด์ƒ๋„ ์ด๋ฏธ์ง€ ์ƒ์„ฑ REALVISXL V5", "url": "https://seawolf2357-REALVISXL-V5.hf.space"},
{"name": "[OFAI]ํ…์ŠคํŠธ๋กœ ๊ฐ์ฒด๋งŒ ์ž˜๋ผ๋‚ด๊ณ  ๋ฐฐ๊ฒฝ ํˆฌ๋ช…ํ™”", "url": "https://fantos-textcutobject.hf.space"},
{"name": "[OFAI]๋น„๋””์˜ค ์ธ์‹ QnA ์ฑ—๋ด‡ ", "url": "https://ginipick-vidiqa.hf.space"},
{"name": "[OFAI]์ด๋ฏธ์ง€ ์Šค์ผ€์ผ์—…(ํ™”์งˆ๊ฐœ์„ ) ", "url": "https://ginipick-finegrain-image-enhancer.hf.space"},
{"name": "[OFAI]์ด๋ฏธ์ง€ ๋ฐฐ๊ฒฝ ์ œ๊ฑฐ ", "url": "https://ginipick-background-removal.hf.space"},
{"name": "[OFAI]๋น„๋””์˜ค ๋ฐฐ๊ฒฝ ์ œ๊ฑฐ ", "url": "https://fantaxy-remove-video-background.hf.space"},
{"name": "[OFAI]ํ…์ŠคํŠธ ์ž…๋ ฅ์œผ๋กœ ์Œ์•… ์ƒ์„ฑ ", "url": "https://fantaxy-stable-audio-open-zero.hf.space"},
{"name": "[OFAI]ํ•œ๊ตญ์–ด ์„œ์น˜-VLM", "url": "https://fantos-jinjavis.hf.space"},
{"name": "[OFAI]MS PHI 3.5 Vision ", "url": "https://aiqtech-phi35-vision.hf.space"},
{"name": "[OFAI]NSFW kAI ", "url": "https://fantaxy-ofai-kai.hf.space"},
{"name": "[OFAI]๋ฉ”ํƒ€ LLAMA 3.1 405B ", "url": "https://seawolf2357-ofai-405.hf.space"},
{"name": "[OFAI]๋ฉ”ํƒ€ LLAMA 3.1 70B ", "url": "https://fantaxy-ofai-70.hf.space"},
{"name": "[OFAI]๋ฉ”ํƒ€ LLAMA 3.1 8B ", "url": "https://seawolf2357-ofai-8.hf.space"},
{"name": "[OFAI]๋ฏธ์ŠคํŠธ๋ž„ 7B Instruct v0.3 ", "url": "https://fantaxy-ofai-mis7b.hf.space"},
{"name": "[OFAI]MS Phi 3 mini 4k-instruct ", "url": "https://fantaxy-ofai-phi.hf.space"},
{"name": "[OFAI]์ค‘๊ตญ Yi 1.5 34B ", "url": "https://fantaxy-ofai-yi.hf.space"},
{"name": "[OFAI]๋ฏธ์ŠคํŠธ๋ž„ Mixtral 8X7B ", "url": "https://fantaxy-ofai-8x7b.hf.space"},
{"name": "[OFAI]๋ฏธ์ŠคํŠธ๋ž„ Nemo Instruct 2407 ", "url": "https://seawolf2357-ofai-mistral-nemo.hf.space"},
{"name": "[OFAI]๋ธ”๋กœ๊ทธ ์ž๋™(์ปจํŽŒ/๋‹จ์ˆ˜) ์ƒ์„ฑ ", "url": "https://fantaxy-blogger-send-webhook-confirm-image.hf.space"},
{"name": "[OFAI]๋ธ”๋กœ๊ทธ ์ž๋™(๋ฌด์ธ/๋ณต์ˆ˜) ์ƒ์„ฑ ", "url": "https://fantaxy-blogger-send-webhook-auto-image.hf.space"},
{"name": "[OFAI]์ „๋ฌธ ๋ธ”๋กœ๊ทธ ์ƒ์„ฑ ", "url": "https://seawolf2357-ofai-jinjavis-blog.hf.space"},
{"name": "[OFAI]์˜ํ•™ ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ์ƒ์„ฑ ", "url": "https://seawolf2357-ofai-jinjavis-blog-medi.hf.space"},
{"name": "[OFAI]์•ฝ๋ฆฌํ•™ ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ์ƒ์„ฑ ", "url": "https://seawolf2357-ofai-jinjavis-blog-pharm.hf.space"},
{"name": "[T+I2I] ๋‚ด ์–ผ๊ตด ์‚ฌ์ง„์œผ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ III ", "url": "https://fantaxy-flx-pulid.hf.space"},
{"name": "[T2I] FLUX GIF ์ƒ์„ฑ II ", "url": "https://fantaxy-flux-gif-animations-2.hf.space"},
{"name": "FLUX ์ด๋ฏธ์ง€์ƒ์„ฑ ํƒ€์ž„๋จธ์‹  ", "url": "https://ginipick-flx-timemach.hf.space"},
{"name": "FLUX ์‹ค์‹œ๊ฐ„ ์ด๋ฏธ์ง€ ์ƒ์„ฑ ", "url": "https://ginipick-Realtime-FLUX.hf.space"},
{"name": "๋‚ด ์‚ฌ์ง„์œผ๋กœ ์˜ท ๊ฐˆ์•„์ž…ํžˆ๊ธฐ ", "url": "https://aiqcamp-fash2.hf.space"},
{"name": "์ด๋ฏธ์ง€ ์ธ์‹์œผ๋กœ FLUX ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ ", "url": "https://aiqcamp-flxcaptin.hf.space"},
{"name": "์Œ์„ฑ ๋ณต์ œํ•˜๊ณ  ํ…์ŠคํŠธ๋กœ ์Œ์„ฑ ์ƒ์„ฑ ", "url": "https://aiqcamp-kovoicclon.hf.space"},
{"name": "์ด๋ฏธ์ง€ ๋งˆ์Šคํ‚น+ํ”„๋กฌํ”„ํŠธ๋กœ ์ด๋ฏธ์ง€ ๋ณ€ํ˜•", "url": "https://aiqtech-imaginpaint.hf.space"},
]
class MyModel(BaseModel):
request: Any
model_config = ConfigDict(arbitrary_types_allowed=True)
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 f"๋น„์ •์ƒ (์ฝ”๋“œ: {response.status_code})", "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():
while True:
time.sleep(60) # 60์ดˆ ๋Œ€๊ธฐ
new_status = update_status()
gr.update(value=new_status)
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, daemon=True).start()
return app
if __name__ == "__main__":
dashboard = create_dashboard()
dashboard.launch()