Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -19,36 +19,48 @@ def start_timer(url, interval):
|
|
19 |
check_connection(url)
|
20 |
|
21 |
# ํ์ด๋จธ ์์ ํจ์๋ฅผ Gradio์ ์
๋ ฅ๊ณผ ํจ๊ป ์ฐ๊ฒฐํฉ๋๋ค.
|
22 |
-
def setup_timer(
|
23 |
interval_seconds = interval * 60 # ๋ถ์ ์ด๋ก ๋ณํ
|
24 |
-
urls = [url1, url2, url3, url4, url5, url6, url7, url8, url9, url10]
|
25 |
for url in urls:
|
26 |
if url: # URL์ด ๋น์ด ์์ง ์์ผ๋ฉด ํ์ด๋จธ ์์
|
27 |
start_timer(url, interval_seconds)
|
28 |
return "ํ์ด๋จธ๊ฐ ์ค์ ๋์์ต๋๋ค."
|
29 |
|
30 |
# Gradio UI ์ปดํฌ๋ํธ๋ฅผ ์ ์ํฉ๋๋ค.
|
31 |
-
|
32 |
-
url_input2 = gr.Text(label="URL 2", placeholder="์ ์ํ ๋ ๋ฒ์งธ URL์ ์
๋ ฅํ์ธ์")
|
33 |
-
url_input3 = gr.Text(label="URL 3", placeholder="์ ์ํ ์ธ ๋ฒ์งธ URL์ ์
๋ ฅํ์ธ์")
|
34 |
-
url_input4 = gr.Text(label="URL 4", placeholder="์ ์ํ ๋ค ๋ฒ์งธ URL์ ์
๋ ฅํ์ธ์")
|
35 |
-
url_input5 = gr.Text(label="URL 5", placeholder="์ ์ํ ๋ค์ฏ ๋ฒ์งธ URL์ ์
๋ ฅํ์ธ์")
|
36 |
-
url_input6 = gr.Text(label="URL 6", placeholder="์ ์ํ ์ฌ์ฏ ๋ฒ์งธ URL์ ์
๋ ฅํ์ธ์")
|
37 |
-
url_input7 = gr.Text(label="URL 7", placeholder="์ ์ํ ์ผ๊ณฑ ๋ฒ์งธ URL์ ์
๋ ฅํ์ธ์")
|
38 |
-
url_input8 = gr.Text(label="URL 8", placeholder="์ ์ํ ์ฌ๋ ๋ฒ์งธ URL์ ์
๋ ฅํ์ธ์")
|
39 |
-
url_input9 = gr.Text(label="URL 9", placeholder="์ ์ํ ์ํ ๋ฒ์งธ URL์ ์
๋ ฅํ์ธ์")
|
40 |
-
url_input10 = gr.Text(label="URL 10", placeholder="์ ์ํ ์ด ๋ฒ์งธ URL์ ์
๋ ฅํ์ธ์")
|
41 |
interval_input = gr.Slider(minimum=1, maximum=60, step=1, value=5, label="์ ์ ์ฃผ๊ธฐ(๋ถ)")
|
42 |
|
43 |
# Gradio ์ฑ ์ค์
|
44 |
app = gr.Interface(
|
45 |
fn=setup_timer,
|
46 |
-
inputs=
|
47 |
outputs="text",
|
48 |
title="URL ์ ์ ์ฒด์ปค",
|
49 |
-
description="
|
50 |
examples=[
|
51 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
],
|
53 |
cache_examples=False # ์บ์ ๋นํ์ฑํ
|
54 |
)
|
|
|
19 |
check_connection(url)
|
20 |
|
21 |
# ํ์ด๋จธ ์์ ํจ์๋ฅผ Gradio์ ์
๋ ฅ๊ณผ ํจ๊ป ์ฐ๊ฒฐํฉ๋๋ค.
|
22 |
+
def setup_timer(*urls, interval):
|
23 |
interval_seconds = interval * 60 # ๋ถ์ ์ด๋ก ๋ณํ
|
|
|
24 |
for url in urls:
|
25 |
if url: # URL์ด ๋น์ด ์์ง ์์ผ๋ฉด ํ์ด๋จธ ์์
|
26 |
start_timer(url, interval_seconds)
|
27 |
return "ํ์ด๋จธ๊ฐ ์ค์ ๋์์ต๋๋ค."
|
28 |
|
29 |
# Gradio UI ์ปดํฌ๋ํธ๋ฅผ ์ ์ํฉ๋๋ค.
|
30 |
+
url_inputs = [gr.Text(label=f"URL {i+1}", placeholder=f"์ ์ํ URL {i+1}์ ์
๋ ฅํ์ธ์") for i in range(20)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
interval_input = gr.Slider(minimum=1, maximum=60, step=1, value=5, label="์ ์ ์ฃผ๊ธฐ(๋ถ)")
|
32 |
|
33 |
# Gradio ์ฑ ์ค์
|
34 |
app = gr.Interface(
|
35 |
fn=setup_timer,
|
36 |
+
inputs=url_inputs + [interval_input],
|
37 |
outputs="text",
|
38 |
title="URL ์ ์ ์ฒด์ปค",
|
39 |
+
description="์ต๋ ์ค๋ฌด ๊ฐ์ URL๊ณผ ์ ์ ์ฃผ๊ธฐ๋ฅผ ์
๋ ฅํ๊ณ '์์' ๋ฒํผ์ ํด๋ฆญํ์ธ์. ์ง์ ๋ ์ฃผ๊ธฐ๋ก HTTP ์ํ ์ฝ๋ ๋ฐ ์ ์ ์ํ๋ฅผ ํ์ธํฉ๋๋ค.",
|
40 |
examples=[
|
41 |
+
[
|
42 |
+
"https://seawolf2357-FastGPT.hf.space",
|
43 |
+
"https://seawolf2357-NaverTalk.hf.space",
|
44 |
+
"https://seawolf2357-timer.hf.space",
|
45 |
+
"https://seawolf2357-timer2.hf.space",
|
46 |
+
"https://seawolf2357-disc1ch-2.hf.space",
|
47 |
+
"https://seawolf2357-kai-girlfriend.hf.space",
|
48 |
+
"https://seawolf2357-kai-boyfriend.hf.space",
|
49 |
+
"https://seawolf2357-kai-grandma.hf.space",
|
50 |
+
"https://seawolf2357-kai-simsime.hf.space",
|
51 |
+
"https://seawolf2357-kai-blog.hf.space",
|
52 |
+
"https://seawolf2357-test1.hf.space",
|
53 |
+
"https://seawolf2357-test2.hf.space",
|
54 |
+
"https://seawolf2357-test3.hf.space",
|
55 |
+
"https://seawolf2357-test4.hf.space",
|
56 |
+
"https://seawolf2357-test5.hf.space",
|
57 |
+
"https://seawolf2357-test6.hf.space",
|
58 |
+
"https://seawolf2357-test7.hf.space",
|
59 |
+
"https://seawolf2357-test8.hf.space",
|
60 |
+
"https://seawolf2357-test9.hf.space",
|
61 |
+
"https://seawolf2357-test10.hf.space",
|
62 |
+
15
|
63 |
+
]
|
64 |
],
|
65 |
cache_examples=False # ์บ์ ๋นํ์ฑํ
|
66 |
)
|