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'{target["name"]}: {status}' 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()