seawolf2357 commited on
Commit
377e71c
ยท
verified ยท
1 Parent(s): 871bd91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -15
app.py CHANGED
@@ -19,36 +19,48 @@ def start_timer(url, interval):
19
  check_connection(url)
20
 
21
  # ํƒ€์ด๋จธ ์‹œ์ž‘ ํ•จ์ˆ˜๋ฅผ Gradio์˜ ์ž…๋ ฅ๊ณผ ํ•จ๊ป˜ ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค.
22
- def setup_timer(url1, url2, url3, url4, url5, url6, url7, url8, url9, url10, interval):
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
- url_input1 = gr.Text(label="URL 1", placeholder="์ ‘์†ํ•  ์ฒซ ๋ฒˆ์งธ URL์„ ์ž…๋ ฅํ•˜์„ธ์š”")
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=[url_input1, url_input2, url_input3, url_input4, url_input5, url_input6, url_input7, url_input8, url_input9, url_input10, interval_input],
47
  outputs="text",
48
  title="URL ์ ‘์† ์ฒด์ปค",
49
- description="์—ฌ์„ฏ ๊ฐœ์˜ URL๊ณผ ์ ‘์† ์ฃผ๊ธฐ๋ฅผ ์ž…๋ ฅํ•˜๊ณ  '์‹œ์ž‘' ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์„ธ์š”. ์ง€์ •๋œ ์ฃผ๊ธฐ๋กœ HTTP ์ƒํƒœ ์ฝ”๋“œ ๋ฐ ์ ‘์† ์ƒํƒœ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.",
50
  examples=[
51
- ["https://seawolf2357-FastGPT.hf.space", "https://seawolf2357-NaverTalk.hf.space", "https://seawolf2357-timer.hf.space", "https://seawolf2357-timer2.hf.space", "https://seawolf2357-disc1ch-2.hf.space", "https://seawolf2357-kai-girlfriend.hf.space", "https://seawolf2357-kai-boyfriend.hf.space", "https://seawolf2357-kai-grandma.hf.space","https://seawolf2357-kai-simsime.hf.space","https://seawolf2357-kai-blog.hf.space",15]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  )