| | import gradio as gr |
| | import aiohttp |
| | import asyncio |
| | import threading |
| |
|
| | |
| | async def check_connection(url): |
| | try: |
| | async with aiohttp.ClientSession() as session: |
| | async with session.get(url) as response: |
| | status = f"URL: {url} ์ํ ์ฝ๋: {response.status}, ์ ์ ์ํ: {'์ ์ ์ฑ๊ณต' if response.status == 200 else '์ ์ ์คํจ'}" |
| | print(status) |
| | return status |
| | except Exception as e: |
| | status = f"URL: {url} ์ ์ ์คํจ: {str(e)}" |
| | print(status) |
| | return status |
| |
|
| | |
| | async def start_timer(urls, interval): |
| | while True: |
| | for url in urls: |
| | if url: |
| | await check_connection(url) |
| | await asyncio.sleep(1) |
| | await asyncio.sleep(interval - len(urls)) |
| |
|
| | |
| | def setup_timer(interval, *urls): |
| | interval_seconds = interval * 60 |
| | |
| | threading.Thread(target=asyncio.run, args=(start_timer(urls, interval_seconds),)).start() |
| | return "ํ์ด๋จธ๊ฐ ์ค์ ๋์์ต๋๋ค." |
| |
|
| | |
| | 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=5, label="์ ์ ์ฃผ๊ธฐ(๋ถ)") |
| |
|
| | |
| | app = gr.Interface( |
| | fn=setup_timer, |
| | inputs=[interval_input] + url_inputs, |
| | outputs="text", |
| | title="URL ์ ์ ์ฒด์ปค", |
| | description="์ต๋ 40๊ฐ์ URL๊ณผ ์ ์ ์ฃผ๊ธฐ๋ฅผ ์
๋ ฅํ๊ณ '์์' ๋ฒํผ์ ํด๋ฆญํ์ธ์. ์ง์ ๋ ์ฃผ๊ธฐ๋ก HTTP ์ํ ์ฝ๋ ๋ฐ ์ ์ ์ํ๋ฅผ ํ์ธํฉ๋๋ค.", |
| | examples=[ |
| | [ |
| | 15, |
| | "https://fantaxy-timer1.hf.space", |
| | |
| | |
| | "https://fantaxy-kai-llm-claude35.hf.space", |
| | "https://fantaxy-kai-llm-gpt4o.hf.space", |
| | "https://fantaxy-kai-llm-l370b.hf.space", |
| | "https://fantaxy-kai-llm-l38b.hf.space", |
| | "https://fantaxy-kai-llm-phi3.hf.space", |
| | "https://fantaxy-kai-llm-mix87.hf.space", |
| | "https://fantaxy-kai-llm-aya.hf.space", |
| | "https://fantaxy-kai-llm-zepr.hf.space", |
| | "https://fantaxy-kai-llm-yi.hf.space", |
| | "https://ginipick-kai-llm-law1.hf.space", |
| | |
| | "https://fantaxy-kai-charac-yok.hf.space", |
| | "https://fantaxy-kai-charac-mbti.hf.space", |
| | "https://fantaxy-kai-charac-girlfriend.hf.space", |
| | "https://fantaxy-kai-charac-ana.hf.space", |
| | "https://fantaxy-kai-charac-pluting.hf.space", |
| | "https://fantaxy-kai-charac-simsim.hf.space", |
| | "https://fantaxy-kai-charac-boyfriend.hf.space", |
| | "https://fantaxy-kai-llm-persona.hf.space", |
| | "https://fantaxy-kai-llm-trans.hf.space", |
| | "https://fantaxy-kai-llm-code.hf.space", |
| | "https://fantaxy-kai-llm-novel.hf.space", |
| | "https://ginipick-gini-ytb-private-replysend.hf.space", |
| | "https://seawolf2357-kai-saju.hf.space", |
| | "https://ginipick-gini-saju.hf.space", |
| | "https://fantos-opencodeai.hf.space", |
| | "https://seawolf2357-kai-l3-405b.hf.space", |
| | "https://ginipick-gini-api-chat.hf.space", |
| | "https://ginipick-gini-api-blog.hf.space", |
| | "https://ginipick-gini-api-script.hf.space", |
| | "https://ginipick-gini-api-market.hf.space", |
| | "https://seawolf2357-kai-llm-mislarge2.hf.space", |
| | "https://seawolf2357-kai-llm-upstage.hf.space", |
| | "https://seawolf2357-kai-llm-medi.hf.space", |
| | "https://seawolf2357-kai-llm-pharm.hf.space", |
| | "https://seawolf2357-kai-llm-insu.hf.space", |
| | "https://seawolf2357-kai-llm-search.hf.space", |
| | "https://seawolf2357-kai-llm-copy.hf.space", |
| | "https://ginipick-EXAONE-3.0-7.8B-Instruct.hf.space", |
| | "https://fantaxy-kai-llm-math.hf.space" |
| | ] |
| | ], |
| | cache_examples=False |
| | ) |
| |
|
| | if __name__ == "__main__": |
| | app.launch() |