import gradio as gr import requests import threading import time # 외부 URL에 접속하는 함수를 정의합니다. def check_connection(url): try: response = requests.get(url) status = f"URL: {url} 상태 코드: {response.status_code}, 접속 상태: {'접속 성공' if response.status_code == 200 else '접속 실패'}" except Exception as e: status = f"URL: {url} 접속 실패: {str(e)}" print(status) return status # 타이머를 사용하여 정해진 주기로 함수를 반복 실행합니다. def start_timer(url, interval): threading.Timer(interval, start_timer, [url, interval]).start() check_connection(url) # 타이머 시작 함수를 Gradio의 입력과 함께 연결합니다. def setup_timer(interval, *urls): interval_seconds = interval * 60 # 분을 초로 변환 for url in urls: if url: # URL이 비어 있지 않으면 타이머 시작 start_timer(url, interval_seconds) return "타이머가 설정되었습니다." # Gradio UI 컴포넌트를 정의합니다. url_inputs = [gr.Text(label=f"URL {i+1}", placeholder=f"접속할 URL {i+1}을 입력하세요") for i in range(40)] interval_input = gr.Slider(minimum=1, maximum=60, step=1, value=15, label="접속 주기(분)") # Gradio 앱 설정 app = gr.Interface( fn=setup_timer, inputs=[interval_input] + url_inputs, outputs="text", title="URL 접속 체커", description="최대 40개의 URL과 접속 주기를 입력하고 '시작' 버튼을 클릭하세요. 지정된 주기로 HTTP 상태 코드 및 접속 상태를 확인합니다.", examples=[ [ 15, "https://seawolf2357-timer4.hf.space", "https://seawolf2357-timer.hf.space", "https://seawolf2357-timer2.hf.space", "https://fantaxy-timer1.hf.space", "https://fantaxy-timer2.hf.space", "https://seawolf2357-kai-pluting.hf.space", "https://fantaxy-kai-flx-id.hf.space", "https://seawolf2357-ofai-405.hf.space",#여기부터 openfree.ai 서비스용 배치 시작 "https://fantaxy-ofai-70.hf.space", "https://seawolf2357-ofai-8.hf.space", "https://seawolf2357-ofai-Mistral-Nemo.hf.space", "https://fantaxy-ofai-8x7b.hf.space", "https://fantaxy-ofai-phi.hf.space", "https://fantaxy-ofai-Yi.hf.space", "https://fantaxy-ofai-mis7b.hf.space", "https://fantaxy-ofai-kai.hf.space", # "https://fantaxy-ofai-flx-expl-notio.hf.space", "https://fantaxy-ofai-it2v2.hf.space", "https://fantaxy-ofai-flx-expl-store.hf.space", "https://fantaxy-ofai-t2v.hf.space", "https://ginipick-FLUX-Prompt-Generator.hf.space", "https://ginipick-VidiQA.hf.space", "https://ginipick-finegrain-image-enhancer.hf.space", "https://ginipick-background-removal.hf.space", "https://fantaxy-playground25.hf.space", "https://fantaxy-Stable-Audio-Open-Zero.hf.space", "https://fantaxy-Remove-Video-Background.hf.space", "https://fantaxy-AuroFlow-v3.hf.space", "https://ginipick-stable-fast-3d.hf.space", "https://fantaxy-Kolors-IPAdapter.hf.space", "https://ginipick-Phi-35-vision.hf.space", "https://seawolf2357-whiwebgpu.hf.space", "https://ginipick-ofai-flxnf4.hf.space", # "https://ginipick-AccDiffusion.hf.space", "https://seawolf2357-jinjavis.hf.space", "https://seawolf2357-jinjavis-chat-api.hf.space", "https://seawolf2357-jinjavis-blog-api.hf.space", "https://seawolf2357-jinjavis-blog-medi.hf.space", "https://seawolf2357-jinjavis-blog-pharm.hf.space", "https://seawolf2357-ofai-jinjavis-blog.hf.space", "https://seawolf2357-ofai-jinjavis-blog-medi.hf.space", "https://seawolf2357-ofai-jinjavis-blog-pharm.hf.space" ] ], cache_examples=False # 캐시 비활성화 ) app.launch()